Package org.opensaml.saml.common.messaging.context

# Class SAMLPeerEntityContext

java.lang.Object
org.opensaml.messaging.context.BaseContext
org.opensaml.saml.common.messaging.context.AbstractSAMLEntityContext
org.opensaml.saml.common.messaging.context.AbstractAuthenticatableSAMLEntityContext
org.opensaml.saml.common.messaging.context.SAMLPeerEntityContext

All Implemented Interfaces:
  `Iterable<BaseContext>`

public final class SAMLPeerEntityContext extends AbstractAuthenticatableSAMLEntityContext
Subcontext that carries information about a SAML peer entity.

This context will often contain subcontexts, whose data is construed to be scoped to that peer entity.

The method `getEntityId()` will attempt to dynamically resolve the appropriate data from the SAML message held in the message context if the data has not been set statically by the corresponding setter method. This evaluation will be attempted only if the this context instance is an immediate child of the message context, as returned by `BaseContext.getParent()`.

## Nested Class Summary

## Nested classes/interfaces inherited from class org.opensaml.messaging.context.BaseContext

`BaseContext.ContextSetNoRemoveIteratorDecorator, BaseContext.DeprecatedContextClassNameLookAside`

## Field Summary

Fields
Modifier and Type
Field
Description
`private org.slf4j.Logger`
`log`
Logger.
`private boolean`
`useSAML1QueryResourceAsEntityId`
Whether to use the resource of SAML 1 queries to resolve the entity ID.

## Constructor Summary

Constructors
Constructor
Description
`SAMLPeerEntityContext()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`String`
`getEntityId()`
Gets the entityId of the SAML entity.
`boolean`
`getUseSAML1QueryResourceAsEntityId()`
Gets whether to use the Resource attribute of some SAML 1 queries to resolve the entity ID.
`protected String`
`processSaml1AttributeQuery(AttributeQuery query)`
Resolve the SAML entity ID from a SAML 1 AttributeQuery.
`protected String`
`processSaml1AuthorizationDecisionQuery(AuthorizationDecisionQuery query)`
Resolve the SAML entityID from a SAML 1 AuthorizationDecisionQuery.
`protected String`
`processSaml1Request(Request request)`
Resolve the SAML entity ID from a SAML 1 request.
`protected String`
`processSaml1Response(Response response)`
Resolve the SAML entity ID from a SAML 1 response.
`protected String`
`processSaml2Issuer(Issuer issuer)`
Resolve the SAML entity ID from a SAML 2 Issuer.
`protected String`
`processSaml2Request(RequestAbstractType request)`
Resolve the SAML entity ID from a SAML 2 request.
`protected String`
`processSaml2Response(StatusResponseType statusResponse)`
Resolve the SAML entity ID from a SAML 2 response.
`protected String`
`processSaml2ResponseAssertions(Response response)`
Resolve the SAML entity ID from the Assertions of a SAML 2 response.
`protected String`
`resolveEntityId()`
Dynamically resolve the SAML peer entity ID from the SAML protocol message held in `MessageContext.getMessage()`.
`protected SAMLObject`
`resolveSAMLMessage()`
Resolve the SAML message from the message context.
`void`
`setUseSAML1QueryResourceAsEntityId(boolean useResource)`
Sets whether to use the Resource attribute of some SAML 1 queries to resolve the entity ID.

### Methods inherited from class org.opensaml.saml.common.messaging.context.AbstractAuthenticatableSAMLEntityContext

`isAuthenticated, setAuthenticated`

### Methods inherited from class org.opensaml.saml.common.messaging.context.AbstractSAMLEntityContext

`getRole, setEntityId, setRole`

### Methods inherited from class org.opensaml.messaging.context.BaseContext

`addSubcontext, addSubcontext, clearSubcontexts, containsSubcontext, createSubcontext, ensureSubcontext, ensureSubcontext, getParent, getSubcontext, getSubcontext, getSubcontext, getSubcontext, iterator, removeFromParent, removeSubcontext, removeSubcontext, setParent`

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

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

### Methods inherited from interface java.lang.Iterable

`forEach, spliterator`

## Field Details

### log

@Nonnull private org.slf4j.Logger log
Logger.

### useSAML1QueryResourceAsEntityId

private boolean useSAML1QueryResourceAsEntityId
Whether to use the resource of SAML 1 queries to resolve the entity ID.

## Constructor Details

### SAMLPeerEntityContext

public SAMLPeerEntityContext()
Constructor.

## Method Details

### getEntityId

@Nullable @NotEmpty public String getEntityId()
Gets the entityId of the SAML entity.

Overrides:
  `getEntityId` in class `AbstractSAMLEntityContext`
Returns:
  entityId of the SAML entity, may be null

### getUseSAML1QueryResourceAsEntityId

public boolean getUseSAML1QueryResourceAsEntityId()
Gets whether to use the Resource attribute of some SAML 1 queries to resolve the entity ID.

Returns:
  whether to use the Resource attribute of some SAML 1 queries to resolve the entity ID

### setUseSAML1QueryResourceAsEntityId

public void setUseSAML1QueryResourceAsEntityId(boolean useResource)
Sets whether to use the Resource attribute of some SAML 1 queries to resolve the entity ID.

Parameters:
  `useResource` - whether to use the Resource attribute of some SAML 1 queries to resolve the entity ID

### resolveEntityId

@Nullable protected String resolveEntityId()
Dynamically resolve the SAML peer entity ID from the SAML protocol message held in `MessageContext.getMessage()`.

Returns:
  the entity ID, or null if it could not be resolved

### processSaml2Request

@Nullable protected String processSaml2Request(@Nonnull RequestAbstractType request)
Resolve the SAML entity ID from a SAML 2 request.

Parameters:
  `request` - the request
Returns:
  the entity ID, or null if it could not be resolved

### processSaml2Response

@Nullable protected String processSaml2Response(@Nonnull StatusResponseType statusResponse)
Resolve the SAML entity ID from a SAML 2 response.

Parameters:
  `statusResponse` - the response
Returns:
  the entity ID, or null if it could not be resolved

### processSaml2ResponseAssertions

@Nullable protected String processSaml2ResponseAssertions(@Nonnull Response response)
Resolve the SAML entity ID from the Assertions of a SAML 2 response.

Parameters:
  `response` - the response
Returns:
  the entity ID, or null if it could not be resolved

### processSaml2Issuer

@Nullable protected String processSaml2Issuer(@Nullable Issuer issuer)
Resolve the SAML entity ID from a SAML 2 Issuer.

Parameters:
  `issuer` - the issuer
Returns:
  the entity ID, or null if it could not be resolved

### processSaml1Response

@Nullable protected String processSaml1Response(@Nonnull Response response)
Resolve the SAML entity ID from a SAML 1 response.

Parameters:
  `response` - the response
Returns:
  the entity ID, or null if it could not be resolved

### processSaml1Request

@Nullable protected String processSaml1Request(@Nonnull Request request)
Resolve the SAML entity ID from a SAML 1 request.

Parameters:
  `request` - the request
Returns:
  the entity ID, or null if it could not be resolved

### processSaml1AttributeQuery

@Nullable protected String processSaml1AttributeQuery(@Nonnull AttributeQuery query)
Resolve the SAML entity ID from a SAML 1 AttributeQuery.

Parameters:
  `query` - the query
Returns:
  the entity ID, or null if it could not be resolved

### processSaml1AuthorizationDecisionQuery

@Nullable protected String processSaml1AuthorizationDecisionQuery(@Nonnull AuthorizationDecisionQuery query)
Resolve the SAML entityID from a SAML 1 AuthorizationDecisionQuery.

Parameters:
  `query` - the query
Returns:
  the entity ID, or null if it could not be resolved

### resolveSAMLMessage

@Nullable protected SAMLObject resolveSAMLMessage()
Resolve the SAML message from the message context.

Returns:
  the SAML message, or null if it can not be resolved