Package net.shibboleth.idp.saml.saml2.profile.impl

# Class SAMLAuthnController

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.idp.saml.saml2.profile.impl.SAMLAuthnController

All Implemented Interfaces:
  `Component`, `DestructableComponent`, `InitializableComponent`

@Controller @RequestMapping("%{idp.authn.SAML.externalAuthnPath:/Authn/SAML2}") public class SAMLAuthnController extends AbstractInitializableComponent
MVC controller that handles outbound and inbound message I/O for proxied SAML authentication.

Outbound messaging is necessary to ensure webflow hygiene with respect to flow state, and inbound messaging is necessary to ensure a fixed URL for SAML endpoint management.

Since:
  4.0.0

## Field Summary

Fields
Modifier and Type
Field
Description
`private Map<String,BindingDescriptor>`
`bindingMap`
Map of binding short names to deduce inbound binding constant.
`private final org.slf4j.Logger`
`log`
Class logger.
`private Function<ProfileRequestContext,ProfileRequestContext>`
`profileRequestContextLookupStrategy`
Lookup strategy to locate the nested ProfileRequestContext.
`private Function<ProfileRequestContext,SAMLAuthnContext>`
`samlContextLookupStrategy`
Lookup strategy to locate the SAML context.
`private Map<String,HttpServletRequestValidator>`
`validatorMap`
Map of binding short names to HttpServletRequest validator.

## Constructor Summary

Constructors
Constructor
Description
`SAMLAuthnController()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`void`
`finishSAML(HttpServletRequest httpRequest, HttpServletResponse httpResponse, String binding)`
Inbound completion of the process, triggered by default for any methods.
`void`
`setInboundBindings(Collection<BindingDescriptor> bindings)`
Set inbound bindings to use to deduce ProtocolBinding attribute.
`void`
`setProfileRequestContextLookupStrategy(Function<ProfileRequestContext,ProfileRequestContext> strategy)`
Set the lookup strategy used to locate the nested `ProfileRequestContext`.
`void`
`setSAMLAuthnContextLookupStrategy(Function<ProfileRequestContext,SAMLAuthnContext> strategy)`
Set the lookup strategy used to locate the `SAMLAuthnContext`.
`void`
`setValidators(Map<String,HttpServletRequestValidator> validators)`
Set the HTTP request validators.
`void`
`startSAML(HttpServletRequest httpRequest, HttpServletResponse httpResponse, String binding)`
Outbound initiation of the process, triggered with a fixed addition to the path.
`private void`
`validateRequest(HttpServletRequest httpRequest, String binding)`
Validate the inbound HTTP request.

### Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

`checkComponentActive, checkSetterPreconditions, destroy, doDestroy, doInitialize, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitialized`

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

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

## Field Details

### log

@Nonnull private final org.slf4j.Logger log
Class logger.

### profileRequestContextLookupStrategy

@Nonnull private Function<ProfileRequestContext,ProfileRequestContext> profileRequestContextLookupStrategy
Lookup strategy to locate the nested ProfileRequestContext.

### samlContextLookupStrategy

@Nonnull private Function<ProfileRequestContext,SAMLAuthnContext> samlContextLookupStrategy
Lookup strategy to locate the SAML context.

### bindingMap

@Nonnull private Map<String,BindingDescriptor> bindingMap
Map of binding short names to deduce inbound binding constant.

### validatorMap

@Nonnull private Map<String,HttpServletRequestValidator> validatorMap
Map of binding short names to HttpServletRequest validator.

## Constructor Details

### SAMLAuthnController

public SAMLAuthnController()
Constructor.

## Method Details

### setProfileRequestContextLookupStrategy

public void setProfileRequestContextLookupStrategy(@Nonnull Function<ProfileRequestContext,ProfileRequestContext> strategy)
Set the lookup strategy used to locate the nested `ProfileRequestContext`.

Parameters:
  `strategy` - lookup strategy

### setSAMLAuthnContextLookupStrategy

public void setSAMLAuthnContextLookupStrategy(@Nonnull Function<ProfileRequestContext,SAMLAuthnContext> strategy)
Set the lookup strategy used to locate the `SAMLAuthnContext`.

Parameters:
  `strategy` - lookup strategy

### setInboundBindings

public void setInboundBindings(@Nullable Collection<BindingDescriptor> bindings)
Set inbound bindings to use to deduce ProtocolBinding attribute.

Parameters:
  `bindings` - the bindings to set

### setValidators

public void setValidators(@Nullable Map<String,HttpServletRequestValidator> validators)
Set the HTTP request validators.

Parameters:
  `validators` - the validators map

### startSAML

@GetMapping("/{binding}/SSO/start") public void startSAML(@Nonnull HttpServletRequest httpRequest, @Nonnull HttpServletResponse httpResponse, @PathVariable @Nonnull @NotEmpty String binding) throws ExternalAuthenticationException, IOException
Outbound initiation of the process, triggered with a fixed addition to the path.

Parameters:
  `httpRequest` - servlet request
  `httpResponse` - servlet response
  `binding` - a key for the eventual inbound binding
Throws:
  `ExternalAuthenticationException` - if an error occurs
  `IOException` - if an I/O error occurs

### finishSAML

@RequestMapping("/{binding}/SSO") public void finishSAML(@Nonnull HttpServletRequest httpRequest, @Nonnull HttpServletResponse httpResponse, @PathVariable @Nonnull @NotEmpty String binding) throws ExternalAuthenticationException, IOException
Inbound completion of the process, triggered by default for any methods.

Parameters:
  `httpRequest` - servlet request
  `httpResponse` - servlet response
  `binding` - a key for the inbound binding
Throws:
  `ExternalAuthenticationException` - if an error occurs
  `IOException` - if an I/O error occurs

### validateRequest

private void validateRequest(@Nonnull HttpServletRequest httpRequest, @Nonnull String binding) throws ExternalAuthenticationException
Validate the inbound HTTP request.

Parameters:
  `httpRequest` - the request to validate
  `binding` - a key for the inbound binding
Throws:
  `ExternalAuthenticationException` - if the request is determined to be invalid