org.keycloak.protocol.saml

## Class DefaultSamlArtifactResolver

- java.lang.Object
- - org.keycloak.protocol.saml.DefaultSamlArtifactResolver

- All Implemented Interfaces:
    ArtifactResolver, Provider

      public class DefaultSamlArtifactResolver
      extends Object
      implements ArtifactResolver

  ArtifactResolver for artifact-04 format. Other kind of format for artifact are allowed by standard but not specified. Artifact 04 is the only one specified in SAML2.0 specification.

- - ### Field Summary

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

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultSamlArtifactResolver()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `buildArtifact(AuthenticatedClientSessionModel clientSessionModel, String entityId, String artifactResponse)` Creates and stores an artifact
    `void` | `close()`
    `String` | `createArtifact(String entityId)` Creates an artifact.
    `String` | `resolveArtifact(AuthenticatedClientSessionModel clientSessionModel, String artifact)` Returns a serialized Saml ArtifactResponse corresponding to the artifact that was created by `buildArtifact`
    `ClientModel` | `selectSourceClient(KeycloakSession session, String artifact)` Returns client model that issued artifact

    - ### 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

    - #### DefaultSamlArtifactResolver

          public DefaultSamlArtifactResolver()

  - ### Method Detail

    - #### resolveArtifact

          public String resolveArtifact(AuthenticatedClientSessionModel clientSessionModel,
                                        String artifact)
                                 throws ArtifactResolverProcessingException

      Description copied from interface: `ArtifactResolver`
      Returns a serialized Saml ArtifactResponse corresponding to the artifact that was created by `buildArtifact`
      Specified by:
        `resolveArtifact` in interface `ArtifactResolver`
      Parameters:
        `clientSessionModel` - client session model that can be used for obtaining the artifact response
        `artifact` - the artifact
      Returns:
        serialized Saml ArtifactResponse corresponding to the artifact
      Throws:
        `ArtifactResolverProcessingException` - When an error occurs during resolution of the artifact.

    - #### selectSourceClient

          public ClientModel selectSourceClient(KeycloakSession session,
                                                String artifact)
                                         throws ArtifactResolverProcessingException

      Description copied from interface: `ArtifactResolver`
      Returns client model that issued artifact
      Specified by:
        `selectSourceClient` in interface `ArtifactResolver`
      Parameters:
        `session` - KeycloakSession for searching for client corresponding client
        `artifact` - the artifact
      Returns:
        the client model that issued the artifact
      Throws:
        `ArtifactResolverProcessingException` - When an error occurs during client search

    - #### buildArtifact

          public String buildArtifact(AuthenticatedClientSessionModel clientSessionModel,
                                      String entityId,
                                      String artifactResponse)
                               throws ArtifactResolverProcessingException

      Description copied from interface: `ArtifactResolver`
      Creates and stores an artifact
      Specified by:
        `buildArtifact` in interface `ArtifactResolver`
      Parameters:
        `clientSessionModel` - client session model that can be used for storing the response for artifact
        `entityId` - id of an issuer that issued the artifactResponse
        `artifactResponse` - serialized Saml ArtifactResponse that represents the response for created artifact
      Returns:
        the artifact
      Throws:
        `ArtifactResolverProcessingException` - When an error occurs during creation of the artifact.

    - #### createArtifact

          public String createArtifact(String entityId)
                                throws ArtifactResolverProcessingException

      Creates an artifact. Format is:

      SAML_artifact := B64(TypeCode EndpointIndex RemainingArtifact)

      TypeCode := 0x0004 EndpointIndex := Byte1Byte2 RemainingArtifact := SourceID MessageHandle

      SourceID := 20-byte_sequence, used by the artifact receiver to determine artifact issuer MessageHandle := 20-byte_sequence

      Parameters:
        `entityId` - the entity id to encode in the sourceId
      Returns:
        an artifact
      Throws:
        `ArtifactResolverProcessingException`

    - #### close

          public void close()

      Specified by:
        `close` in interface `Provider`

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