Package org.keycloak.protocol.saml
Class SamlService
java.lang.Object
org.keycloak.protocol.AuthorizationEndpointBase
org.keycloak.protocol.saml.SamlService
- Direct Known Subclasses:
SamlEcpProfileService
Resource class for the saml connect token service
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassprotected classprotected class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected static final org.jboss.logging.LoggerFields inherited from class org.keycloak.protocol.AuthorizationEndpointBase
APP_INITIATED_FLOW, authManager, clientConnection, event, headers, httpRequest, realm, session -
Constructor Summary
ConstructorsConstructorDescriptionSamlService(KeycloakSession session, EventBuilder event, DestinationValidator destinationValidator) -
Method Summary
Modifier and TypeMethodDescriptionjakarta.ws.rs.core.ResponseartifactResolutionService(InputStream inputStream) Handles SOAP messages.jakarta.ws.rs.core.ResponseartifactResolve(ArtifactResolveType artifactResolveMessage, SAMLDocumentHolder artifactResolveHolder) Takes an artifact resolve message and returns the artifact response, if the artifact is found belonging to a session of the issuer.static intcompareKeys(KeyWrapper o1, KeyWrapper o2) static StringgetIDPMetadataDescriptor(jakarta.ws.rs.core.UriInfo uriInfo, KeycloakSession session, RealmModel realm) getOrCreateLoginSessionForIdpInitiatedSso(KeycloakSession session, RealmModel realm, ClientModel client, String relayState) Creates a client session object for SAML IdP-initiated SSO session.jakarta.ws.rs.core.ResponseidpInitiatedSSO(String clientUrlName, String relayState) protected jakarta.ws.rs.core.ResponsenewBrowserAuthentication(AuthenticationSessionModel authSession, boolean isPassive, boolean redirectToAuthentication) protected jakarta.ws.rs.core.ResponsenewBrowserAuthentication(AuthenticationSessionModel authSession, boolean isPassive, boolean redirectToAuthentication, SamlProtocol samlProtocol) voidpostBinding(jakarta.ws.rs.container.AsyncResponse asyncResponse, String samlRequest, String samlResponse, String relayState, String artifact) voidredirectBinding(jakarta.ws.rs.container.AsyncResponse asyncResponse, String samlRequest, String samlResponse, String relayState, String artifact) jakarta.ws.rs.core.ResponsesoapBinding(InputStream inputStream) Handles SOAP messages.Methods inherited from class org.keycloak.protocol.AuthorizationEndpointBase
checkRealm, checkSsl, createAuthenticationSession, createProcessor, getAuthenticationFlow, handleBrowserAuthenticationRequest
-
Field Details
-
logger
protected static final org.jboss.logging.Logger logger -
ARTIFACT_RESOLUTION_SERVICE_PATH
- See Also:
-
-
Constructor Details
-
SamlService
public SamlService(KeycloakSession session, EventBuilder event, DestinationValidator destinationValidator)
-
-
Method Details
-
newBrowserAuthentication
protected jakarta.ws.rs.core.Response newBrowserAuthentication(AuthenticationSessionModel authSession, boolean isPassive, boolean redirectToAuthentication) -
newBrowserAuthentication
protected jakarta.ws.rs.core.Response newBrowserAuthentication(AuthenticationSessionModel authSession, boolean isPassive, boolean redirectToAuthentication, SamlProtocol samlProtocol) -
newRedirectBindingProtocol
-
newPostBindingProtocol
-
redirectBinding
-
postBinding
@POST @Consumes("application/x-www-form-urlencoded") public void postBinding(@Suspended jakarta.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(jakarta.ws.rs.core.UriInfo uriInfo, KeycloakSession session, RealmModel realm) -
compareKeys
-
idpInitiatedSSO
-
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 sessionrealm- Realm to create client session inclient- Client to create client session forrelayState- 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 jakarta.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 jakarta.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 jakarta.ws.rs.core.Response artifactResolve(ArtifactResolveType artifactResolveMessage, SAMLDocumentHolder artifactResolveHolder) throws ParsingException, ConfigurationException, 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 clientartifactResolveHolder- the document containing the artifact resolve message sent by the client- Returns:
- a Response containing the SOAP message with the ArifactResponse
- Throws:
ParsingExceptionConfigurationExceptionProcessingException
-