org.keycloak.protocol.saml

## Class SamlService

- java.lang.Object
- - org.keycloak.protocol.AuthorizationEndpointBase
  - - org.keycloak.protocol.saml.SamlService

- Direct Known Subclasses:
    SamlEcpProfileService

      public class SamlService
      extends AuthorizationEndpointBase

  Resource class for the saml connect token service
  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `SamlService.BindingProtocol`
    `protected class` | `SamlService.PostBindingProtocol`
    `protected class` | `SamlService.RedirectBindingProtocol`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static org.jboss.logging.Logger` | `logger`

    - ### Fields inherited from class org.keycloak.protocol.AuthorizationEndpointBase

      `APP_INITIATED_FLOW, authManager, clientConnection, event, headers, httpRequest, realm, session`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SamlService(RealmModel realm, EventBuilder event, DestinationValidator destinationValidator)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static int` | `compareKeys(KeyWrapper o1, KeyWrapper o2)`
    `String` | `getDescriptor()`
    `static String` | `getIDPMetadataDescriptor(javax.ws.rs.core.UriInfo uriInfo, KeycloakSession session, RealmModel realm)`
    `AuthenticationSessionModel` | `getOrCreateLoginSessionForIdpInitiatedSso(KeycloakSession session, RealmModel realm, ClientModel client, String relayState)` Creates a client session object for SAML IdP-initiated SSO session.
    `javax.ws.rs.core.Response` | `idpInitiatedSSO(String clientUrlName, String relayState)`
    `protected javax.ws.rs.core.Response` | `newBrowserAuthentication(AuthenticationSessionModel authSession, boolean isPassive, boolean redirectToAuthentication)`
    `protected javax.ws.rs.core.Response` | `newBrowserAuthentication(AuthenticationSessionModel authSession, boolean isPassive, boolean redirectToAuthentication, SamlProtocol samlProtocol)`
    `javax.ws.rs.core.Response` | `postBinding(String samlRequest, String samlResponse, String relayState)`
    `javax.ws.rs.core.Response` | `redirectBinding(String samlRequest, String samlResponse, String relayState)`
    `javax.ws.rs.core.Response` | `soapBinding(InputStream inputStream)`

    - ### Methods inherited from class org.keycloak.protocol.AuthorizationEndpointBase

      `checkRealm, checkSsl, createAuthenticationSession, createProcessor, getAuthenticationFlow, handleBrowserAuthenticationRequest`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### logger

          protected static final org.jboss.logging.Logger logger

  - ### Constructor Detail

    - #### SamlService

          public SamlService(RealmModel realm,
                             EventBuilder event,
                             DestinationValidator destinationValidator)

  - ### Method Detail

    - #### newBrowserAuthentication

          protected javax.ws.rs.core.Response newBrowserAuthentication(AuthenticationSessionModel authSession,
                                                                       boolean isPassive,
                                                                       boolean redirectToAuthentication)

    - #### newBrowserAuthentication

          protected javax.ws.rs.core.Response newBrowserAuthentication(AuthenticationSessionModel authSession,
                                                                       boolean isPassive,
                                                                       boolean redirectToAuthentication,
                                                                       SamlProtocol samlProtocol)

    - #### redirectBinding

          @GET
          public javax.ws.rs.core.Response redirectBinding(@QueryParam(value="SAMLRequest")
                                                                String samlRequest,
                                                                @QueryParam(value="SAMLResponse")
                                                                String samlResponse,
                                                                @QueryParam(value="RelayState")
                                                                String relayState)

    - #### postBinding

          @POST
           @Consumes(value="application/x-www-form-urlencoded")
          public javax.ws.rs.core.Response postBinding(@FormParam(value="SAMLRequest")
                                                                                                                   String samlRequest,
                                                                                                                   @FormParam(value="SAMLResponse")
                                                                                                                   String samlResponse,
                                                                                                                   @FormParam(value="RelayState")
                                                                                                                   String relayState)

    - #### getDescriptor

          @GET
           @Path(value="descriptor")
           @Produces(value="application/xml")
          public String getDescriptor()
                                                                                                   throws Exception

      Throws:
        `Exception`

    - #### getIDPMetadataDescriptor

          public static String getIDPMetadataDescriptor(javax.ws.rs.core.UriInfo uriInfo,
                                                        KeycloakSession session,
                                                        RealmModel realm)

    - #### compareKeys

          public static int compareKeys(KeyWrapper o1,
                                        KeyWrapper o2)

    - #### idpInitiatedSSO

          @GET
           @Path(value="clients/{client}")
           @Produces(value="text/html; charset=utf-8")
          public javax.ws.rs.core.Response idpInitiatedSSO(@PathParam(value="client")
                                                                                                                                              String clientUrlName,
                                                                                                                                              @QueryParam(value="RelayState")
                                                                                                                                              String relayState)

    - #### getOrCreateLoginSessionForIdpInitiatedSso

          public AuthenticationSessionModel getOrCreateLoginSessionForIdpInitiatedSso(KeycloakSession session,
                                                                                      RealmModel realm,
                                                                                      ClientModel client,
                                                                                      String relayState)

      Creates a client session object for SAML IdP-initiated SSO session. The session takes the parameters from from client definition, namely binding type and redirect URL.
      Parameters:
        `session` - KC session
        `realm` - Realm to create client session in
        `client` - Client to create client session for
        `relayState` - Optional relay state - free field as per SAML specification
      Returns:
        The auth session model or null if there is no SAML url is found

    - #### soapBinding

          @POST
           @Consumes(value={"application/soap+xml","text/xml"})
          public javax.ws.rs.core.Response soapBinding(InputStream inputStream)

Copyright © 2021 JBoss by Red Hat. All rights reserved.