public class DefaultSecurityLogic<R,C extends WebContext> extends AbstractExceptionAwareLogic<R,C> implements SecurityLogic<R,C>
Default security logic:
If the HTTP request matches the matchers
configuration (or no matchers
are defined),
the security is applied. Otherwise, the user is automatically granted access.
First, if the user is not authenticated (no profile) and if some clients have been defined in the clients
parameter,
a login is tried for the direct clients.
Then, if the user has profile, authorizations are checked according to the authorizers
configuration.
If the authorizations are valid, the user is granted access. Otherwise, a 403 error page is displayed.
Finally, if the user is still not authenticated (no profile), he is redirected to the appropriate identity provider
if the first defined client is an indirect one in the clients
configuration. Otherwise, a 401 error page is displayed.
logger
Constructor and Description |
---|
DefaultSecurityLogic() |
Modifier and Type | Method and Description |
---|---|
protected HttpAction |
forbidden(C context,
List<Client> currentClients,
List<CommonProfile> profiles,
String authorizers)
Return a forbidden error.
|
AjaxRequestResolver |
getAjaxRequestResolver() |
AuthorizationChecker |
getAuthorizationChecker() |
ClientFinder |
getClientFinder() |
MatchingChecker |
getMatchingChecker() |
ProfileStorageDecision |
getProfileStorageDecision() |
R |
perform(C context,
Config config,
SecurityGrantedAccessAdapter<R,C> securityGrantedAccessAdapter,
HttpActionAdapter<R,C> httpActionAdapter,
String clients,
String authorizers,
String matchers,
Boolean inputMultiProfile,
Object... parameters)
Perform the security logic.
|
protected HttpAction |
redirectToIdentityProvider(C context,
List<Client> currentClients)
Perform a redirection to start the login process of the first indirect client.
|
protected void |
saveRequestedUrl(C context,
List<Client> currentClients)
Save the requested url.
|
void |
setAjaxRequestResolver(AjaxRequestResolver ajaxRequestResolver) |
void |
setAuthorizationChecker(AuthorizationChecker authorizationChecker) |
void |
setClientFinder(ClientFinder clientFinder) |
void |
setMatchingChecker(MatchingChecker matchingChecker) |
void |
setProfileStorageDecision(ProfileStorageDecision profileStorageDecision) |
protected boolean |
startAuthentication(C context,
List<Client> currentClients)
Return whether we must start a login process if the first client is an indirect one.
|
String |
toString() |
protected HttpAction |
unauthorized(C context,
List<Client> currentClients)
Return an unauthorized error.
|
getErrorUrl, handleException, runtimeException, setErrorUrl
getProfileManager, getProfileManagerFactory, setProfileManagerFactory
public R perform(C context, Config config, SecurityGrantedAccessAdapter<R,C> securityGrantedAccessAdapter, HttpActionAdapter<R,C> httpActionAdapter, String clients, String authorizers, String matchers, Boolean inputMultiProfile, Object... parameters)
SecurityLogic
perform
in interface SecurityLogic<R,C extends WebContext>
context
- the web contextconfig
- the configurationsecurityGrantedAccessAdapter
- the success adapterhttpActionAdapter
- the HTTP action adapterclients
- the defined clientsauthorizers
- the defined authorizersmatchers
- the defined matchersinputMultiProfile
- whether multi profiles are supportedparameters
- additional parametersprotected HttpAction forbidden(C context, List<Client> currentClients, List<CommonProfile> profiles, String authorizers)
context
- the web contextcurrentClients
- the current clientsprofiles
- the current profilesauthorizers
- the authorizersprotected boolean startAuthentication(C context, List<Client> currentClients)
context
- the web contextcurrentClients
- the current clientsprotected void saveRequestedUrl(C context, List<Client> currentClients)
context
- the web contextcurrentClients
- the current clientsprotected HttpAction redirectToIdentityProvider(C context, List<Client> currentClients)
context
- the web contextcurrentClients
- the current clientsprotected HttpAction unauthorized(C context, List<Client> currentClients)
context
- the web contextcurrentClients
- the current clientspublic ClientFinder getClientFinder()
public void setClientFinder(ClientFinder clientFinder)
public AuthorizationChecker getAuthorizationChecker()
public void setAuthorizationChecker(AuthorizationChecker authorizationChecker)
public MatchingChecker getMatchingChecker()
public void setMatchingChecker(MatchingChecker matchingChecker)
public ProfileStorageDecision getProfileStorageDecision()
public void setProfileStorageDecision(ProfileStorageDecision profileStorageDecision)
public AjaxRequestResolver getAjaxRequestResolver()
public void setAjaxRequestResolver(AjaxRequestResolver ajaxRequestResolver)
Copyright © 2019. All rights reserved.