Package net.shibboleth.idp.cas.flow.impl

# Class GrantServiceTicketAction

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
org.opensaml.profile.action.AbstractProfileAction
org.opensaml.profile.action.AbstractConditionalProfileAction
net.shibboleth.idp.profile.AbstractProfileAction
net.shibboleth.idp.cas.flow.impl.AbstractCASProtocolAction<ServiceTicketRequest,ServiceTicketResponse>
net.shibboleth.idp.cas.flow.impl.GrantServiceTicketAction

All Implemented Interfaces:
  `Component`, `DestructableComponent`, `InitializableComponent`, `ProfileAction`, `Aware`, `MessageSource`, `MessageSourceAware`, `Action`

public class GrantServiceTicketAction extends AbstractCASProtocolAction<ServiceTicketRequest,ServiceTicketResponse>
Generates and stores a CAS protocol service ticket. Possible outcomes:

- `null` on success
- `TicketCreationError`

## Field Summary

Fields
Modifier and Type
Field
Description
`private Function<ProfileRequestContext,AttributeContext>`
`attributeContextLookupStrategy`
Strategy used to locate the `AttributeContext` associated with a given `ProfileRequestContext`.
`private AttributeContext`
`attributeCtx`
AttributeContext to use.
`private final Function<ProfileRequestContext,AuthenticationContext>`
`authnCtxLookupFunction`
AuthenticationContext lookup function.
`private AuthenticationResult`
`authnResult`
Authentication result.
`private final TicketService`
`casTicketService`
Manages CAS tickets.
`private final ConfigLookupFunction<LoginConfiguration>`
`configLookupFunction`
Profile configuration lookup function.
`private final org.slf4j.Logger`
`log`
Class logger.
`private LoginConfiguration`
`loginConfig`
Profile config.
`private final Function<ProfileRequestContext,String>`
`principalLookupFunction`
Function to retrieve subject principal name.
`private ServiceTicketRequest`
`request`
CAS request.
`private SecurityConfiguration`
`securityConfig`
Security config.
`private final Function<ProfileRequestContext,SessionContext>`
`sessionContextFunction`
Looks up an IdP session context from IdP profile request context.
`private boolean`
`storeConsent`
Whether consent needs to be stored in ticket.

## Constructor Summary

Constructors
Constructor
Description
`GrantServiceTicketAction(TicketService ticketService)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected void`
`doExecute(ProfileRequestContext profileRequestContext)`
`protected boolean`
`doPreExecute(ProfileRequestContext profileRequestContext)`
`private IdPSession`
`getIdPSession(ProfileRequestContext prc)`
Get the IdP session.
`private AuthenticationResult`
`getLatestAuthenticationResult(ProfileRequestContext prc)`
Gets the most recent authentication result from the current IdP session.
`private String`
`getPrincipalName(ProfileRequestContext prc)`
Get the IdP subject principal name.
`void`
`setAttributeContextLookupStrategy(Function<ProfileRequestContext,AttributeContext> strategy)`
Set the strategy used to locate the `AttributeContext` associated with a given `ProfileRequestContext`.

### Methods inherited from class net.shibboleth.idp.cas.flow.impl.AbstractCASProtocolAction

`getCASRequest, getCASResponse, getCASService, getCASTicket, getProtocolContext, setCASRequest, setCASResponse, setCASService, setCASTicket`

### Methods inherited from class net.shibboleth.idp.profile.AbstractProfileAction

`doExecute, execute, getBean, getBean, getMessage, getMessage, getMessage, getParameter, getParameter, getProfileContextLookupStrategy, getRequestContext, getResult, setMessageSource, setProfileContextLookupStrategy`

### Methods inherited from class org.opensaml.profile.action.AbstractConditionalProfileAction

`getActivationCondition, setActivationCondition`

### Methods inherited from class org.opensaml.profile.action.AbstractProfileAction

`doPostExecute, doPostExecute, ensureHttpServletRequest, ensureHttpServletResponse, execute, getHttpServletRequest, getHttpServletRequestSupplier, getHttpServletResponse, getHttpServletResponseSupplier, getLogPrefix, isPreExecuteCalled, setHttpServletRequestSupplier, setHttpServletResponseSupplier`

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

### Methods inherited from interface net.shibboleth.shared.component.InitializableComponent

`initialize, isInitialized`

## Field Details

### log

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

### configLookupFunction

@Nonnull private final ConfigLookupFunction<LoginConfiguration> configLookupFunction
Profile configuration lookup function.

### sessionContextFunction

@Nonnull private final Function<ProfileRequestContext,SessionContext> sessionContextFunction
Looks up an IdP session context from IdP profile request context.

### authnCtxLookupFunction

@Nonnull private final Function<ProfileRequestContext,AuthenticationContext> authnCtxLookupFunction
AuthenticationContext lookup function.

### principalLookupFunction

@Nonnull private final Function<ProfileRequestContext,String> principalLookupFunction
Function to retrieve subject principal name.

### attributeContextLookupStrategy

@Nonnull private Function<ProfileRequestContext,AttributeContext> attributeContextLookupStrategy
Strategy used to locate the `AttributeContext` associated with a given `ProfileRequestContext`.

### casTicketService

@Nonnull private final TicketService casTicketService
Manages CAS tickets.

### loginConfig

@NonnullBeforeExec private LoginConfiguration loginConfig
Profile config.

### securityConfig

@NonnullBeforeExec private SecurityConfiguration securityConfig
Security config.

### authnResult

@NonnullBeforeExec private AuthenticationResult authnResult
Authentication result.

### storeConsent

private boolean storeConsent
Whether consent needs to be stored in ticket.

### attributeCtx

@Nullable private AttributeContext attributeCtx
AttributeContext to use.

### request

@NonnullBeforeExec private ServiceTicketRequest request
CAS request.

## Constructor Details

### GrantServiceTicketAction

public GrantServiceTicketAction(@Nonnull TicketService ticketService)
Constructor.

Parameters:
  `ticketService` - Ticket service component.

## Method Details

### setAttributeContextLookupStrategy

public void setAttributeContextLookupStrategy(@Nonnull Function<ProfileRequestContext,AttributeContext> strategy)
Set the strategy used to locate the `AttributeContext` associated with a given `ProfileRequestContext`.

Parameters:
  `strategy` - strategy used to locate the `AttributeContext` associated with a given `ProfileRequestContext`
Since:
  4.2.0

### doPreExecute

protected boolean doPreExecute(@Nonnull ProfileRequestContext profileRequestContext)

Overrides:
  `doPreExecute` in class `AbstractConditionalProfileAction`

### doExecute

protected void doExecute(@Nonnull ProfileRequestContext profileRequestContext)

Overrides:
  `doExecute` in class `AbstractProfileAction`

### getIdPSession

@Nullable private IdPSession getIdPSession(@Nonnull ProfileRequestContext prc)
Get the IdP session.

Parameters:
  `prc` - profile request context
Returns:
  IdP session

### getPrincipalName

@Nonnull private String getPrincipalName(@Nonnull ProfileRequestContext prc)
Get the IdP subject principal name.

Parameters:
  `prc` - profile request context.
Returns:
  Principal name.

### getLatestAuthenticationResult

@Nullable private AuthenticationResult getLatestAuthenticationResult(ProfileRequestContext prc)
Gets the most recent authentication result from the current IdP session.

Parameters:
  `prc` - Profile request context.
Returns:
  Latest authentication result.
Throws:
  `IllegalStateException` - If no authentication results are found.