Package de.xima.fc.web.common.auth
Class FormAuthContext
- java.lang.Object
-
- de.xima.fc.web.common.auth.FormAuthContext
-
- All Implemented Interfaces:
IAuthWebContext
,IFormAuthContext
public class FormAuthContext extends Object implements IFormAuthContext
The authentication context for an form- Author:
- XIMA MEDIA GmbH
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
FormAuthContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Deprecated.protected
FormAuthContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Mandant client)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description org.pac4j.core.config.Config
buildAuthConfig()
Deprecated.Since 7.2.0.org.pac4j.core.config.Config
buildAuthConfig(EAuthenticationFlow authFlow)
void
callback()
Starts the callback handling of the current context.boolean
checkAuthorisation(org.pac4j.core.profile.UserProfile profile)
Checks the authorization of the given profiles against the current contextboolean
checkAuthorization(IUser user)
org.pac4j.core.config.Config
getAuthConfig(EAuthenticationFlow authFlow)
Returns the current configuration of the authentication context for the given authentication flow.List<IAuthenticatorConfigWrapper>
getAuthConfigOptions()
IAuthenticationTarget
getAuthenticationTarget()
String
getAuthenticatorToken()
Deprecated.IClientDescriptor
getAutoExecutableIndirectClient()
Returns the descriptor for the indirect client that may be executed automatically.String
getBaseUrl()
Get the current base URLMandant
getClient()
Get the client to which the form belongs.List<IAuthenticatorClients>
getClients()
Returns an ordered list of the clients for each configured authenticator.List<org.pac4j.core.client.Client>
getClients(EAuthenticationFlow authFlow)
Returns an ordered list of the clients for the given authentication flow.FRQSession
getFRQSession()
Get the current form request session to authenticate withLocale
getLocale()
Returns the locale of the auth contextorg.pac4j.core.profile.ProfileManager
getProfileManager()
LinkedHashMap<String,ProjectAuthenticatorConfig>
getProjectAuthConfig()
Deprecated.javax.servlet.http.HttpServletRequest
getRequest()
Returns the HTTP servlet requestjavax.servlet.http.HttpServletResponse
getResponse()
Returns the HTTP servlet responseorg.pac4j.core.context.session.SessionStore
getSessionStore()
IAuthenticatorConfigWrapper
getTokenAuthConfig()
org.pac4j.core.context.WebContext
getWebContext()
Object
login(EAuthenticationFlow authFlow)
Starts the login logic for the given authentication flow.Object
login(javax.servlet.FilterChain chain, EAuthenticationFlow authFlow)
Starts the login logic for the given authentication flow.void
logout()
Starts the logout from the given authorizations.void
logout(javax.servlet.FilterChain chain)
Starts the logout from the given authorizationsvoid
setAuthenticatorToken(String authenticatorToken)
Deprecated.void
setFRQSession(FRQSession frqSession)
void
setProject(Projekt project)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.xima.fc.interfaces.auth.IFormAuthContext
authorize, authorize, getAuthConfig
-
-
-
-
Constructor Detail
-
FormAuthContext
@Deprecated protected FormAuthContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Deprecated.
-
FormAuthContext
protected FormAuthContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Mandant client)
-
-
Method Detail
-
getRequest
public javax.servlet.http.HttpServletRequest getRequest()
Description copied from interface:IFormAuthContext
Returns the HTTP servlet request- Specified by:
getRequest
in interfaceIAuthWebContext
- Specified by:
getRequest
in interfaceIFormAuthContext
- Returns:
HttpServletRequest
-
getResponse
public javax.servlet.http.HttpServletResponse getResponse()
Description copied from interface:IFormAuthContext
Returns the HTTP servlet response- Specified by:
getResponse
in interfaceIAuthWebContext
- Specified by:
getResponse
in interfaceIFormAuthContext
- Returns:
- HttpServletResponse
-
getAuthenticationTarget
@NotNull public IAuthenticationTarget getAuthenticationTarget()
- Specified by:
getAuthenticationTarget
in interfaceIAuthWebContext
- Returns:
- the authentication target which describes what purpose the authentication is intended for.
-
getWebContext
@NotNull public org.pac4j.core.context.WebContext getWebContext()
- Specified by:
getWebContext
in interfaceIAuthWebContext
- Returns:
- the pac4j web context
-
getSessionStore
public org.pac4j.core.context.session.SessionStore getSessionStore()
- Specified by:
getSessionStore
in interfaceIAuthWebContext
- Returns:
- the pac4j session store
-
getProfileManager
@NotNull public org.pac4j.core.profile.ProfileManager getProfileManager()
- Specified by:
getProfileManager
in interfaceIAuthWebContext
- Returns:
- the pac4j profile manager
-
getTokenAuthConfig
public IAuthenticatorConfigWrapper getTokenAuthConfig()
- Specified by:
getTokenAuthConfig
in interfaceIFormAuthContext
- Returns:
- the
IAuthenticatorConfigWrapper
for a given authenticator token
-
getAuthConfigOptions
public List<IAuthenticatorConfigWrapper> getAuthConfigOptions()
- Specified by:
getAuthConfigOptions
in interfaceIFormAuthContext
- Returns:
- A
List
of all available authenticator configs
-
getClient
public Mandant getClient()
Description copied from interface:IFormAuthContext
Get the client to which the form belongs.- Specified by:
getClient
in interfaceIFormAuthContext
- Returns:
- The current
Mandant
to which the form belongs.
-
getBaseUrl
public String getBaseUrl()
Description copied from interface:IFormAuthContext
Get the current base URL- Specified by:
getBaseUrl
in interfaceIAuthWebContext
- Specified by:
getBaseUrl
in interfaceIFormAuthContext
- Returns:
String
the base URL
-
setProject
public void setProject(Projekt project)
-
getFRQSession
public FRQSession getFRQSession()
Description copied from interface:IFormAuthContext
Get the current form request session to authenticate with- Specified by:
getFRQSession
in interfaceIFormAuthContext
- Returns:
FRQSession
to authenticate
-
setFRQSession
public void setFRQSession(FRQSession frqSession)
-
getLocale
public Locale getLocale()
Description copied from interface:IFormAuthContext
Returns the locale of the auth context- Specified by:
getLocale
in interfaceIFormAuthContext
- Returns:
Locale
-
getAuthConfig
public org.pac4j.core.config.Config getAuthConfig(EAuthenticationFlow authFlow)
Description copied from interface:IFormAuthContext
Returns the current configuration of the authentication context for the given authentication flow. If no configuration is present, the configuration will be build and saved.- Specified by:
getAuthConfig
in interfaceIFormAuthContext
- Parameters:
authFlow
- the authentication flow for which to get the authentication configuration.- Returns:
- The existing or newly created
Config
.
-
getClients
public List<IAuthenticatorClients> getClients()
Description copied from interface:IFormAuthContext
Returns an ordered list of the clients for each configured authenticator.- Specified by:
getClients
in interfaceIFormAuthContext
- Returns:
- An ordered list of the clients for each configured authenticator.
-
getClients
public List<org.pac4j.core.client.Client> getClients(EAuthenticationFlow authFlow)
Description copied from interface:IFormAuthContext
Returns an ordered list of the clients for the given authentication flow. If the clients have not been created for the given authentication flow they will be created.- Specified by:
getClients
in interfaceIFormAuthContext
- Parameters:
authFlow
- The authentication flow for which to get the clients.- Returns:
- An ordered list of the clients for the given authentication flow.
-
getAutoExecutableIndirectClient
public IClientDescriptor getAutoExecutableIndirectClient()
Description copied from interface:IFormAuthContext
Returns the descriptor for the indirect client that may be executed automatically. There may only be an auto executable indirect client iff only one authenticator is configured for the access to the form. Automatic execution of the client will result in immediate redirection to the IDP defined by the client when accessing the form.- Specified by:
getAutoExecutableIndirectClient
in interfaceIFormAuthContext
- Returns:
- the descriptor of the indirect client that may be executed automatically if it exists and
null
otherwise.
-
buildAuthConfig
public org.pac4j.core.config.Config buildAuthConfig(EAuthenticationFlow authFlow)
-
checkAuthorization
public boolean checkAuthorization(IUser user)
- Specified by:
checkAuthorization
in interfaceIFormAuthContext
-
checkAuthorisation
public boolean checkAuthorisation(org.pac4j.core.profile.UserProfile profile)
Description copied from interface:IFormAuthContext
Checks the authorization of the given profiles against the current context- Specified by:
checkAuthorisation
in interfaceIFormAuthContext
- Parameters:
profile
- ACommonProfile
to check- Returns:
true
if authorized, orfalse
otherwise.
-
login
public Object login(EAuthenticationFlow authFlow)
Description copied from interface:IFormAuthContext
Starts the login logic for the given authentication flow.- Specified by:
login
in interfaceIFormAuthContext
- Parameters:
authFlow
- the authentication flow for which to perform the authorization flow.- Returns:
- the created user profile or
null
-
login
public Object login(javax.servlet.FilterChain chain, EAuthenticationFlow authFlow)
Description copied from interface:IFormAuthContext
Starts the login logic for the given authentication flow.- Specified by:
login
in interfaceIFormAuthContext
- Parameters:
chain
-FilterChain
to process after the authorization ornull
authFlow
- the authentication flow for which to perform the authorization flow.- Returns:
- the created user profile or
null
-
callback
public void callback()
Description copied from interface:IFormAuthContext
Starts the callback handling of the current context.- Specified by:
callback
in interfaceIFormAuthContext
-
logout
public void logout()
Description copied from interface:IFormAuthContext
Starts the logout from the given authorizations.- Specified by:
logout
in interfaceIFormAuthContext
-
logout
public void logout(javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
Description copied from interface:IFormAuthContext
Starts the logout from the given authorizations- Specified by:
logout
in interfaceIFormAuthContext
- Parameters:
chain
-FilterChain
to process after the logout- Throws:
IOException
- IO-errors while processing the chainjavax.servlet.ServletException
- Servlet-errors while processing the chain
-
buildAuthConfig
@Deprecated public org.pac4j.core.config.Config buildAuthConfig()
Deprecated.Since 7.2.0. UsebuildAuthConfig(EAuthenticationFlow)
instead.
-
getProjectAuthConfig
@Deprecated public LinkedHashMap<String,ProjectAuthenticatorConfig> getProjectAuthConfig()
Deprecated.- Specified by:
getProjectAuthConfig
in interfaceIFormAuthContext
-
getAuthenticatorToken
@Deprecated public String getAuthenticatorToken()
Deprecated.Description copied from interface:IFormAuthContext
Get the token of the currentIAuthenticator
or the name of an internal authenticator- Specified by:
getAuthenticatorToken
in interfaceIFormAuthContext
- Returns:
String
token or name
-
setAuthenticatorToken
@Deprecated public void setAuthenticatorToken(String authenticatorToken)
Deprecated.Description copied from interface:IFormAuthContext
Set the token of the currentIAuthenticator
- Specified by:
setAuthenticatorToken
in interfaceIFormAuthContext
- Parameters:
authenticatorToken
- The token of the currentIAuthenticator
or the name of an internal authenticator.
-
-