Class SamlService

    • Field Detail

      • logger

        protected static final org.jboss.logging.Logger logger
    • Constructor Detail

      • SamlService

        public SamlService​(org.keycloak.models.KeycloakSession session,
                           org.keycloak.events.EventBuilder event,
                           org.keycloak.saml.validators.DestinationValidator destinationValidator)
    • Method Detail

      • newBrowserAuthentication

        protected javax.ws.rs.core.Response newBrowserAuthentication​(org.keycloak.sessions.AuthenticationSessionModel authSession,
                                                                     boolean isPassive,
                                                                     boolean redirectToAuthentication)
      • newBrowserAuthentication

        protected javax.ws.rs.core.Response newBrowserAuthentication​(org.keycloak.sessions.AuthenticationSessionModel authSession,
                                                                     boolean isPassive,
                                                                     boolean redirectToAuthentication,
                                                                     SamlProtocol samlProtocol)
      • redirectBinding

        @GET
        public void redirectBinding​(@Suspended
                                    javax.ws.rs.container.AsyncResponse asyncResponse,
                                    @QueryParam("SAMLRequest")
                                    String samlRequest,
                                    @QueryParam("SAMLResponse")
                                    String samlResponse,
                                    @QueryParam("RelayState")
                                    String relayState,
                                    @QueryParam("SAMLart")
                                    String artifact)
      • postBinding

        @POST
        @Consumes("application/x-www-form-urlencoded")
        public void postBinding​(@Suspended
                                javax.ws.rs.container.AsyncResponse asyncResponse,
                                @FormParam("SAMLRequest")
                                String samlRequest,
                                @FormParam("SAMLResponse")
                                String samlResponse,
                                @FormParam("RelayState")
                                String relayState,
                                @FormParam("SAMLart")
                                String artifact)
      • getDescriptor

        @GET
        @Path("descriptor")
        @Produces("application/xml")
        public String getDescriptor()
                             throws Exception
        Throws:
        Exception
      • getIDPMetadataDescriptor

        public static String getIDPMetadataDescriptor​(javax.ws.rs.core.UriInfo uriInfo,
                                                      org.keycloak.models.KeycloakSession session,
                                                      org.keycloak.models.RealmModel realm)
      • compareKeys

        public static int compareKeys​(org.keycloak.crypto.KeyWrapper o1,
                                      org.keycloak.crypto.KeyWrapper o2)
      • idpInitiatedSSO

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

        public org.keycloak.sessions.AuthenticationSessionModel getOrCreateLoginSessionForIdpInitiatedSso​(org.keycloak.models.KeycloakSession session,
                                                                                                          org.keycloak.models.RealmModel realm,
                                                                                                          org.keycloak.models.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
      • artifactResolutionService

        @POST
        @Path("resolve")
        @Consumes({"application/soap+xml","text/xml"})
        public javax.ws.rs.core.Response artifactResolutionService​(InputStream inputStream)
        Handles SOAP messages. Chooses the correct response path depending on whether the message is of type ECP or Artifact
        Parameters:
        inputStream - the data of the request.
        Returns:
        The response to the SOAP message
      • soapBinding

        @POST
        @Consumes({"application/soap+xml","text/xml"})
        public javax.ws.rs.core.Response soapBinding​(InputStream inputStream)
        Handles SOAP messages. Chooses the correct response path depending on whether the message is of type ECP
        Parameters:
        inputStream - the data of the request.
        Returns:
        The response to the SOAP message
      • artifactResolve

        public javax.ws.rs.core.Response artifactResolve​(org.keycloak.dom.saml.v2.protocol.ArtifactResolveType artifactResolveMessage,
                                                         org.keycloak.saml.processing.core.saml.v2.common.SAMLDocumentHolder artifactResolveHolder)
                                                  throws org.keycloak.saml.common.exceptions.ParsingException,
                                                         org.keycloak.saml.common.exceptions.ConfigurationException,
                                                         org.keycloak.saml.common.exceptions.ProcessingException
        Takes an artifact resolve message and returns the artifact response, if the artifact is found belonging to a session of the issuer.
        Parameters:
        artifactResolveMessage - The artifact resolve message sent by the client
        artifactResolveHolder - the document containing the artifact resolve message sent by the client
        Returns:
        a Response containing the SOAP message with the ArifactResponse
        Throws:
        org.keycloak.saml.common.exceptions.ParsingException
        org.keycloak.saml.common.exceptions.ConfigurationException
        org.keycloak.saml.common.exceptions.ProcessingException