keycloak-service
公開メンバ関数 | 限定公開メンバ関数 | 限定公開変数類 | 非公開メンバ関数 | 全メンバ一覧
org.keycloak.protocol.saml.SamlService.BindingProtocol クラスabstract
org.keycloak.protocol.saml.SamlService.BindingProtocol の継承関係図
Inheritance graph
org.keycloak.protocol.saml.SamlService.BindingProtocol 連携図
Collaboration graph

公開メンバ関数

Response execute (String samlRequest, String samlResponse, String relayState)
 

限定公開メンバ関数

Response basicChecks (String samlRequest, String samlResponse)
 
Response handleSamlResponse (String samlResponse, String relayState)
 
Response handleSamlRequest (String samlRequest, String relayState)
 
abstract void verifySignature (SAMLDocumentHolder documentHolder, ClientModel client) throws VerificationException
 
abstract SAMLDocumentHolder extractRequestDocument (String samlRequest)
 
abstract SAMLDocumentHolder extractResponseDocument (String response)
 
Response loginRequest (String relayState, AuthnRequestType requestAbstractType, ClientModel client)
 
String getBindingType (AuthnRequestType requestAbstractType)
 
abstract String getBindingType ()
 
Response logoutRequest (LogoutRequestType logoutRequest, ClientModel client, String relayState)
 

限定公開変数類

boolean redirectToAuthentication
 

非公開メンバ関数

boolean isSupportedNameIdFormat (String nameIdFormat)
 
boolean checkSsl ()
 

詳解

関数詳解

◆ basicChecks()

Response org.keycloak.protocol.saml.SamlService.BindingProtocol.basicChecks ( String  samlRequest,
String  samlResponse 
)
inlineprotected
115  {
116  if (!checkSsl()) {
117  event.event(EventType.LOGIN);
118  event.error(Errors.SSL_REQUIRED);
119  return ErrorPage.error(session, null, Response.Status.BAD_REQUEST, Messages.HTTPS_REQUIRED);
120  }
121  if (!realm.isEnabled()) {
122  event.event(EventType.LOGIN_ERROR);
123  event.error(Errors.REALM_DISABLED);
124  return ErrorPage.error(session, null, Response.Status.BAD_REQUEST, Messages.REALM_NOT_ENABLED);
125  }
126 
127  if (samlRequest == null && samlResponse == null) {
128  event.event(EventType.LOGIN);
129  event.error(Errors.INVALID_TOKEN);
130  return ErrorPage.error(session, null, Response.Status.BAD_REQUEST, Messages.INVALID_REQUEST);
131 
132  }
133  return null;
134  }
KeycloakSession session
Definition: AuthorizationEndpointBase.java:69
boolean checkSsl()
Definition: SamlService.java:466
RealmModel realm
Definition: AuthorizationEndpointBase.java:60

◆ checkSsl()

boolean org.keycloak.protocol.saml.SamlService.BindingProtocol.checkSsl ( )
inlineprivate
466  {
467  if (session.getContext().getUri().getBaseUri().getScheme().equals("https")) {
468  return true;
469  } else {
470  return !realm.getSslRequired().isRequired(clientConnection);
471  }
472  }
ClientConnection clientConnection
Definition: AuthorizationEndpointBase.java:71
KeycloakSession session
Definition: AuthorizationEndpointBase.java:69
RealmModel realm
Definition: AuthorizationEndpointBase.java:60

◆ execute()

Response org.keycloak.protocol.saml.SamlService.BindingProtocol.execute ( String  samlRequest,
String  samlResponse,
String  relayState 
)
inline
474  {
475  Response response = basicChecks(samlRequest, samlResponse);
476  if (response != null)
477  return response;
478  if (samlRequest != null)
479  return handleSamlRequest(samlRequest, relayState);
480  else
481  return handleSamlResponse(samlResponse, relayState);
482  }
Response handleSamlRequest(String samlRequest, String relayState)
Definition: SamlService.java:185
Response handleSamlResponse(String samlResponse, String relayState)
Definition: SamlService.java:136
Response basicChecks(String samlRequest, String samlResponse)
Definition: SamlService.java:115

◆ extractRequestDocument()

abstract SAMLDocumentHolder org.keycloak.protocol.saml.SamlService.BindingProtocol.extractRequestDocument ( String  samlRequest)
abstractprotected

◆ extractResponseDocument()

abstract SAMLDocumentHolder org.keycloak.protocol.saml.SamlService.BindingProtocol.extractResponseDocument ( String  response)
abstractprotected

◆ getBindingType() [1/2]

String org.keycloak.protocol.saml.SamlService.BindingProtocol.getBindingType ( AuthnRequestType  requestAbstractType)
inlineprotected
345  {
346  URI requestedProtocolBinding = requestAbstractType.getProtocolBinding();
347 
348  if (requestedProtocolBinding != null) {
349  if (JBossSAMLURIConstants.SAML_HTTP_POST_BINDING.get().equals(requestedProtocolBinding.toString())) {
350  return SamlProtocol.SAML_POST_BINDING;
351  } else {
352  return SamlProtocol.SAML_REDIRECT_BINDING;
353  }
354  }
355 
356  return getBindingType();
357  }

◆ getBindingType() [2/2]

abstract String org.keycloak.protocol.saml.SamlService.BindingProtocol.getBindingType ( )
abstractprotected

◆ handleSamlRequest()

Response org.keycloak.protocol.saml.SamlService.BindingProtocol.handleSamlRequest ( String  samlRequest,
String  relayState 
)
inlineprotected
185  {
186  SAMLDocumentHolder documentHolder = extractRequestDocument(samlRequest);
187  if (documentHolder == null) {
188  event.event(EventType.LOGIN);
189  event.error(Errors.INVALID_TOKEN);
190  return ErrorPage.error(session, null, Response.Status.BAD_REQUEST, Messages.INVALID_REQUEST);
191  }
192 
193  SAML2Object samlObject = documentHolder.getSamlObject();
194 
195  if (! (samlObject instanceof RequestAbstractType)) {
196  event.event(EventType.LOGIN);
197  event.error(Errors.INVALID_SAML_AUTHN_REQUEST);
198  return ErrorPage.error(session, null, Response.Status.BAD_REQUEST, Messages.INVALID_REQUEST);
199  }
200 
201  RequestAbstractType requestAbstractType = (RequestAbstractType) samlObject;
202  final NameIDType issuerNameId = requestAbstractType.getIssuer();
203  String issuer = requestAbstractType.getIssuer() == null ? null : issuerNameId.getValue();
204  ClientModel client = realm.getClientByClientId(issuer);
205 
206  if (client == null) {
207  event.event(EventType.LOGIN);
208  event.client(issuer);
209  event.error(Errors.CLIENT_NOT_FOUND);
210  return ErrorPage.error(session, null, Response.Status.BAD_REQUEST, Messages.UNKNOWN_LOGIN_REQUESTER);
211  }
212 
213  if (!client.isEnabled()) {
214  event.event(EventType.LOGIN);
215  event.error(Errors.CLIENT_DISABLED);
216  return ErrorPage.error(session, null, Response.Status.BAD_REQUEST, Messages.LOGIN_REQUESTER_NOT_ENABLED);
217  }
218  if (client.isBearerOnly()) {
219  event.event(EventType.LOGIN);
220  event.error(Errors.NOT_ALLOWED);
221  return ErrorPage.error(session, null, Response.Status.BAD_REQUEST, Messages.BEARER_ONLY);
222  }
223  if (!client.isStandardFlowEnabled()) {
224  event.event(EventType.LOGIN);
225  event.error(Errors.NOT_ALLOWED);
226  return ErrorPage.error(session, null, Response.Status.BAD_REQUEST, Messages.STANDARD_FLOW_DISABLED);
227  }
228 
229  session.getContext().setClient(client);
230 
231  try {
232  verifySignature(documentHolder, client);
233  } catch (VerificationException e) {
234  SamlService.logger.error("request validation failed", e);
235  event.event(EventType.LOGIN);
236  event.error(Errors.INVALID_SIGNATURE);
237  return ErrorPage.error(session, null, Response.Status.BAD_REQUEST, Messages.INVALID_REQUESTER);
238  }
239  logger.debug("verified request");
240  if (samlObject instanceof AuthnRequestType) {
241  logger.debug("** login request");
242  event.event(EventType.LOGIN);
243  // Get the SAML Request Message
244  AuthnRequestType authn = (AuthnRequestType) samlObject;
245  return loginRequest(relayState, authn, client);
246  } else if (samlObject instanceof LogoutRequestType) {
247  logger.debug("** logout request");
248  event.event(EventType.LOGOUT);
249  LogoutRequestType logout = (LogoutRequestType) samlObject;
250  return logoutRequest(logout, client, relayState);
251 
252  } else {
253  event.event(EventType.LOGIN);
254  event.error(Errors.INVALID_TOKEN);
255  return ErrorPage.error(session, null, Response.Status.BAD_REQUEST, Messages.INVALID_REQUEST);
256  }
257  }
Response loginRequest(String relayState, AuthnRequestType requestAbstractType, ClientModel client)
Definition: SamlService.java:265
static final Logger logger
Definition: SamlService.java:99
SamlService(RealmModel realm, EventBuilder event, DestinationValidator destinationValidator)
Definition: SamlService.java:103
abstract void verifySignature(SAMLDocumentHolder documentHolder, ClientModel client)
abstract SAMLDocumentHolder extractRequestDocument(String samlRequest)
Response logoutRequest(LogoutRequestType logoutRequest, ClientModel client, String relayState)
Definition: SamlService.java:369
KeycloakSession session
Definition: AuthorizationEndpointBase.java:69
RealmModel realm
Definition: AuthorizationEndpointBase.java:60

◆ handleSamlResponse()

Response org.keycloak.protocol.saml.SamlService.BindingProtocol.handleSamlResponse ( String  samlResponse,
String  relayState 
)
inlineprotected
136  {
137  event.event(EventType.LOGOUT);
138  SAMLDocumentHolder holder = extractResponseDocument(samlResponse);
139 
140  if (! (holder.getSamlObject() instanceof StatusResponseType)) {
141  event.detail(Details.REASON, "invalid_saml_response");
142  event.error(Errors.INVALID_SAML_RESPONSE);
143  return ErrorPage.error(session, null, Response.Status.BAD_REQUEST, Messages.INVALID_REQUEST);
144  }
145 
146  StatusResponseType statusResponse = (StatusResponseType) holder.getSamlObject();
147  // validate destination
148  if (! destinationValidator.validate(session.getContext().getUri().getAbsolutePath(), statusResponse.getDestination())) {
149  event.detail(Details.REASON, "invalid_destination");
150  event.error(Errors.INVALID_SAML_LOGOUT_RESPONSE);
151  return ErrorPage.error(session, null, Response.Status.BAD_REQUEST, Messages.INVALID_REQUEST);
152  }
153 
154  AuthenticationManager.AuthResult authResult = authManager.authenticateIdentityCookie(session, realm, false);
155  if (authResult == null) {
156  logger.warn("Unknown saml response.");
157  event.event(EventType.LOGOUT);
158  event.error(Errors.INVALID_TOKEN);
159  return ErrorPage.error(session, null, Response.Status.BAD_REQUEST, Messages.INVALID_REQUEST);
160  }
161  // assume this is a logout response
162  UserSessionModel userSession = authResult.getSession();
163  if (userSession.getState() != UserSessionModel.State.LOGGING_OUT) {
164  logger.warn("Unknown saml response.");
165  logger.warn("UserSession is not tagged as logging out.");
166  event.event(EventType.LOGOUT);
167  event.error(Errors.INVALID_SAML_LOGOUT_RESPONSE);
168  return ErrorPage.error(session, null, Response.Status.BAD_REQUEST, Messages.INVALID_REQUEST);
169  }
170  String issuer = statusResponse.getIssuer().getValue();
171  ClientModel client = realm.getClientByClientId(issuer);
172  if (client == null) {
173  event.event(EventType.LOGOUT);
174  event.client(issuer);
175  event.error(Errors.CLIENT_NOT_FOUND);
176  return ErrorPage.error(session, null, Response.Status.BAD_REQUEST, Messages.CLIENT_NOT_FOUND);
177  }
178  session.getContext().setClient(client);
179  logger.debug("logout response");
180  Response response = authManager.browserLogout(session, realm, userSession, session.getContext().getUri(), clientConnection, headers);
181  event.success();
182  return response;
183  }
static final Logger logger
Definition: SamlService.java:99
AuthResult authenticateIdentityCookie(KeycloakSession session, RealmModel realm)
Definition: AuthenticationManager.java:695
abstract SAMLDocumentHolder extractResponseDocument(String response)
HttpHeaders headers
Definition: AuthorizationEndpointBase.java:65
ClientConnection clientConnection
Definition: AuthorizationEndpointBase.java:71
final DestinationValidator destinationValidator
Definition: SamlService.java:101
AuthenticationManager authManager
Definition: AuthorizationEndpointBase.java:62
KeycloakSession session
Definition: AuthorizationEndpointBase.java:69
static Response browserLogout(KeycloakSession session, RealmModel realm, UserSessionModel userSession, UriInfo uriInfo, ClientConnection connection, HttpHeaders headers)
Definition: AuthenticationManager.java:492
RealmModel realm
Definition: AuthorizationEndpointBase.java:60

◆ isSupportedNameIdFormat()

boolean org.keycloak.protocol.saml.SamlService.BindingProtocol.isSupportedNameIdFormat ( String  nameIdFormat)
inlineprivate
359  {
360  if (nameIdFormat.equals(JBossSAMLURIConstants.NAMEID_FORMAT_EMAIL.get()) || nameIdFormat.equals(JBossSAMLURIConstants.NAMEID_FORMAT_TRANSIENT.get()) || nameIdFormat.equals(JBossSAMLURIConstants.NAMEID_FORMAT_PERSISTENT.get())
361  || nameIdFormat.equals(JBossSAMLURIConstants.NAMEID_FORMAT_UNSPECIFIED.get())) {
362  return true;
363  }
364  return false;
365  }

◆ loginRequest()

Response org.keycloak.protocol.saml.SamlService.BindingProtocol.loginRequest ( String  relayState,
AuthnRequestType  requestAbstractType,
ClientModel  client 
)
inlineprotected
265  {
266  SamlClient samlClient = new SamlClient(client);
267  // validate destination
268  if (requestAbstractType.getDestination() == null && samlClient.requiresClientSignature()) {
269  event.detail(Details.REASON, "invalid_destination");
270  event.error(Errors.INVALID_SAML_AUTHN_REQUEST);
271  return ErrorPage.error(session, null, Response.Status.BAD_REQUEST, Messages.INVALID_REQUEST);
272  }
273  if (! destinationValidator.validate(session.getContext().getUri().getAbsolutePath(), requestAbstractType.getDestination())) {
274  event.detail(Details.REASON, "invalid_destination");
275  event.error(Errors.INVALID_SAML_AUTHN_REQUEST);
276  return ErrorPage.error(session, null, Response.Status.BAD_REQUEST, Messages.INVALID_REQUEST);
277  }
278  String bindingType = getBindingType(requestAbstractType);
279  if (samlClient.forcePostBinding())
280  bindingType = SamlProtocol.SAML_POST_BINDING;
281  String redirect;
282  URI redirectUri = requestAbstractType.getAssertionConsumerServiceURL();
283  if (redirectUri != null && ! "null".equals(redirectUri.toString())) { // "null" is for testing purposes
284  redirect = RedirectUtils.verifyRedirectUri(session.getContext().getUri(), redirectUri.toString(), realm, client);
285  } else {
286  if (bindingType.equals(SamlProtocol.SAML_POST_BINDING)) {
287  redirect = client.getAttribute(SamlProtocol.SAML_ASSERTION_CONSUMER_URL_POST_ATTRIBUTE);
288  } else {
289  redirect = client.getAttribute(SamlProtocol.SAML_ASSERTION_CONSUMER_URL_REDIRECT_ATTRIBUTE);
290  }
291  if (redirect == null) {
292  redirect = client.getManagementUrl();
293  }
294 
295  }
296 
297  if (redirect == null) {
298  event.error(Errors.INVALID_REDIRECT_URI);
299  return ErrorPage.error(session, null, Response.Status.BAD_REQUEST, Messages.INVALID_REDIRECT_URI);
300  }
301 
302  AuthenticationSessionModel authSession = createAuthenticationSession(client, relayState);
303 
304  authSession.setProtocol(SamlProtocol.LOGIN_PROTOCOL);
305  authSession.setRedirectUri(redirect);
306  authSession.setAction(AuthenticationSessionModel.Action.AUTHENTICATE.name());
307  authSession.setClientNote(SamlProtocol.SAML_BINDING, bindingType);
308  authSession.setClientNote(GeneralConstants.RELAY_STATE, relayState);
309  authSession.setClientNote(SamlProtocol.SAML_REQUEST_ID, requestAbstractType.getID());
310 
311  // Handle NameIDPolicy from SP
312  NameIDPolicyType nameIdPolicy = requestAbstractType.getNameIDPolicy();
313  final URI nameIdFormatUri = nameIdPolicy == null ? null : nameIdPolicy.getFormat();
314  if (nameIdFormatUri != null && ! samlClient.forceNameIDFormat()) {
315  String nameIdFormat = nameIdFormatUri.toString();
316  // TODO: Handle AllowCreate too, relevant for persistent NameID.
317  if (isSupportedNameIdFormat(nameIdFormat)) {
318  authSession.setClientNote(GeneralConstants.NAMEID_FORMAT, nameIdFormat);
319  } else {
320  event.detail(Details.REASON, "unsupported_nameid_format");
321  event.error(Errors.INVALID_SAML_AUTHN_REQUEST);
322  return ErrorPage.error(session, null, Response.Status.BAD_REQUEST, Messages.UNSUPPORTED_NAME_ID_FORMAT);
323  }
324  }
325 
326  //Reading subject/nameID in the saml request
327  SubjectType subject = requestAbstractType.getSubject();
328  if (subject != null) {
329  SubjectType.STSubType subType = subject.getSubType();
330  if (subType != null) {
331  BaseIDAbstractType baseID = subject.getSubType().getBaseID();
332  if (baseID != null && baseID instanceof NameIDType) {
333  NameIDType nameID = (NameIDType) baseID;
334  authSession.setClientNote(OIDCLoginProtocol.LOGIN_HINT_PARAM, nameID.getValue());
335  }
336 
337  }
338  }
339  //If unset we fall back to default "false"
340  final boolean isPassive = (null == requestAbstractType.isIsPassive() ?
341  false : requestAbstractType.isIsPassive().booleanValue());
342  return newBrowserAuthentication(authSession, isPassive, redirectToAuthentication);
343  }
boolean redirectToAuthentication
Definition: SamlService.java:113
AuthenticationSessionModel createAuthenticationSession(ClientModel client, String requestState)
Definition: AuthorizationEndpointBase.java:166
Response newBrowserAuthentication(AuthenticationSessionModel authSession, boolean isPassive, boolean redirectToAuthentication)
Definition: SamlService.java:539
final DestinationValidator destinationValidator
Definition: SamlService.java:101
boolean isSupportedNameIdFormat(String nameIdFormat)
Definition: SamlService.java:359
KeycloakSession session
Definition: AuthorizationEndpointBase.java:69
RealmModel realm
Definition: AuthorizationEndpointBase.java:60

◆ logoutRequest()

Response org.keycloak.protocol.saml.SamlService.BindingProtocol.logoutRequest ( LogoutRequestType  logoutRequest,
ClientModel  client,
String  relayState 
)
inlineprotected
369  {
370  SamlClient samlClient = new SamlClient(client);
371  // validate destination
372  if (logoutRequest.getDestination() == null && samlClient.requiresClientSignature()) {
373  event.detail(Details.REASON, "invalid_destination");
374  event.error(Errors.INVALID_SAML_LOGOUT_REQUEST);
375  return ErrorPage.error(session, null, Response.Status.BAD_REQUEST, Messages.INVALID_REQUEST);
376  }
377  if (! destinationValidator.validate(logoutRequest.getDestination(), session.getContext().getUri().getAbsolutePath())) {
378  event.detail(Details.REASON, "invalid_destination");
379  event.error(Errors.INVALID_SAML_LOGOUT_REQUEST);
380  return ErrorPage.error(session, null, Response.Status.BAD_REQUEST, Messages.INVALID_REQUEST);
381  }
382 
383  // authenticate identity cookie, but ignore an access token timeout as we're logging out anyways.
384  AuthenticationManager.AuthResult authResult = authManager.authenticateIdentityCookie(session, realm, false);
385  if (authResult != null) {
386  String logoutBinding = getBindingType();
387  String postBindingUri = SamlProtocol.getLogoutServiceUrl(session.getContext().getUri(), client, SamlProtocol.SAML_POST_BINDING);
388  if (samlClient.forcePostBinding() && postBindingUri != null && ! postBindingUri.trim().isEmpty())
389  logoutBinding = SamlProtocol.SAML_POST_BINDING;
390  boolean postBinding = Objects.equals(SamlProtocol.SAML_POST_BINDING, logoutBinding);
391 
392  String bindingUri = SamlProtocol.getLogoutServiceUrl(session.getContext().getUri(), client, logoutBinding);
393  UserSessionModel userSession = authResult.getSession();
394  userSession.setNote(SamlProtocol.SAML_LOGOUT_BINDING_URI, bindingUri);
395  if (samlClient.requiresRealmSignature()) {
396  userSession.setNote(SamlProtocol.SAML_LOGOUT_SIGNATURE_ALGORITHM, samlClient.getSignatureAlgorithm().toString());
397 
398  }
399  if (relayState != null)
400  userSession.setNote(SamlProtocol.SAML_LOGOUT_RELAY_STATE, relayState);
401  userSession.setNote(SamlProtocol.SAML_LOGOUT_REQUEST_ID, logoutRequest.getID());
402  userSession.setNote(SamlProtocol.SAML_LOGOUT_BINDING, logoutBinding);
403  userSession.setNote(SamlProtocol.SAML_LOGOUT_ADD_EXTENSIONS_ELEMENT_WITH_KEY_INFO, Boolean.toString((! postBinding) && samlClient.addExtensionsElementWithKeyInfo()));
404  userSession.setNote(SamlProtocol.SAML_SERVER_SIGNATURE_KEYINFO_KEY_NAME_TRANSFORMER, samlClient.getXmlSigKeyInfoKeyNameTransformer().name());
405  userSession.setNote(SamlProtocol.SAML_LOGOUT_CANONICALIZATION, samlClient.getCanonicalizationMethod());
406  userSession.setNote(AuthenticationManager.KEYCLOAK_LOGOUT_PROTOCOL, SamlProtocol.LOGIN_PROTOCOL);
407  // remove client from logout requests
408  AuthenticatedClientSessionModel clientSession = userSession.getAuthenticatedClientSessionByClient(client.getId());
409  if (clientSession != null) {
410  clientSession.setAction(AuthenticationSessionModel.Action.LOGGED_OUT.name());
411  }
412  logger.debug("browser Logout");
413  return authManager.browserLogout(session, realm, userSession, session.getContext().getUri(), clientConnection, headers);
414  } else if (logoutRequest.getSessionIndex() != null) {
415  for (String sessionIndex : logoutRequest.getSessionIndex()) {
416 
417  AuthenticatedClientSessionModel clientSession = SamlSessionUtils.getClientSession(session, realm, sessionIndex);
418  if (clientSession == null)
419  continue;
420  UserSessionModel userSession = clientSession.getUserSession();
421  if (clientSession.getClient().getClientId().equals(client.getClientId())) {
422  // remove requesting client from logout
423  clientSession.setAction(AuthenticationSessionModel.Action.LOGGED_OUT.name());
424  }
425 
426  try {
427  authManager.backchannelLogout(session, realm, userSession, session.getContext().getUri(), clientConnection, headers, true);
428  } catch (Exception e) {
429  logger.warn("Failure with backchannel logout", e);
430  }
431 
432  }
433 
434  }
435 
436  // default
437 
438  String logoutBinding = getBindingType();
439  String logoutBindingUri = SamlProtocol.getLogoutServiceUrl(session.getContext().getUri(), client, logoutBinding);
440  String logoutRelayState = relayState;
441  SAML2LogoutResponseBuilder builder = new SAML2LogoutResponseBuilder();
442  builder.logoutRequestID(logoutRequest.getID());
443  builder.destination(logoutBindingUri);
444  builder.issuer(RealmsResource.realmBaseUrl(session.getContext().getUri()).build(realm.getName()).toString());
445  JaxrsSAML2BindingBuilder binding = new JaxrsSAML2BindingBuilder().relayState(logoutRelayState);
446  boolean postBinding = SamlProtocol.SAML_POST_BINDING.equals(logoutBinding);
447  if (samlClient.requiresRealmSignature()) {
448  SignatureAlgorithm algorithm = samlClient.getSignatureAlgorithm();
449  KeyManager.ActiveRsaKey keys = session.keys().getActiveRsaKey(realm);
450  binding.signatureAlgorithm(algorithm).signWith(keys.getKid(), keys.getPrivateKey(), keys.getPublicKey(), keys.getCertificate()).signDocument();
451  if (! postBinding && samlClient.addExtensionsElementWithKeyInfo()) { // Only include extension if REDIRECT binding and signing whole SAML protocol message
452  builder.addExtension(new KeycloakKeySamlExtensionGenerator(keys.getKid()));
453  }
454  }
455  try {
456  if (postBinding) {
457  return binding.postBinding(builder.buildDocument()).response(logoutBindingUri);
458  } else {
459  return binding.redirectBinding(builder.buildDocument()).response(logoutBindingUri);
460  }
461  } catch (Exception e) {
462  throw new RuntimeException(e);
463  }
464  }
static final Logger logger
Definition: SamlService.java:99
AuthResult authenticateIdentityCookie(KeycloakSession session, RealmModel realm)
Definition: AuthenticationManager.java:695
HttpHeaders headers
Definition: AuthorizationEndpointBase.java:65
ClientConnection clientConnection
Definition: AuthorizationEndpointBase.java:71
final DestinationValidator destinationValidator
Definition: SamlService.java:101
AuthenticationManager authManager
Definition: AuthorizationEndpointBase.java:62
Response postBinding(@FormParam(GeneralConstants.SAML_REQUEST_KEY) String samlRequest, @FormParam(GeneralConstants.SAML_RESPONSE_KEY) String samlResponse, @FormParam(GeneralConstants.RELAY_STATE) String relayState)
Definition: SamlService.java:562
Response logoutRequest(LogoutRequestType logoutRequest, ClientModel client, String relayState)
Definition: SamlService.java:369
KeycloakSession session
Definition: AuthorizationEndpointBase.java:69
static Response browserLogout(KeycloakSession session, RealmModel realm, UserSessionModel userSession, UriInfo uriInfo, ClientConnection connection, HttpHeaders headers)
Definition: AuthenticationManager.java:492
static void backchannelLogout(KeycloakSession session, UserSessionModel userSession, boolean logoutBroker)
Definition: AuthenticationManager.java:186
RealmModel realm
Definition: AuthorizationEndpointBase.java:60

◆ verifySignature()

abstract void org.keycloak.protocol.saml.SamlService.BindingProtocol.verifySignature ( SAMLDocumentHolder  documentHolder,
ClientModel  client 
) throws VerificationException
abstractprotected

メンバ詳解

◆ redirectToAuthentication

boolean org.keycloak.protocol.saml.SamlService.BindingProtocol.redirectToAuthentication
protected

このクラス詳解は次のファイルから抽出されました: