-
- All Known Subinterfaces:
SecurityInterceptor
- All Known Implementing Classes:
DefaultSecurityKit
public interface SecurityKit- Author:
- Vladlen Larionov
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringREQUIRE_AUTHORITY_METHODstatic java.lang.StringREQUIRE_PRINCIPAL_METHOD
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <P extends Principal>
PgetPrincipal()Returns active valid principal if it present.booleanhasAuthority(java.lang.String... authorityId)Check active principal for at least one valid authority.default voidrequireAuthority(java.lang.String... authorityId)For the active principal checks the presence of at least one valid authority.default voidrequirePrincipal()Checks the presence of active valid principal.voidsetPrincipal(Principal principal)
-
-
-
Field Detail
-
REQUIRE_AUTHORITY_METHOD
static final java.lang.String REQUIRE_AUTHORITY_METHOD
- See Also:
- Constant Field Values
-
REQUIRE_PRINCIPAL_METHOD
static final java.lang.String REQUIRE_PRINCIPAL_METHOD
- See Also:
- Constant Field Values
-
-
Method Detail
-
getPrincipal
<P extends Principal> P getPrincipal()
Returns active valid principal if it present.- Returns:
- null if principal is invalid or absent.
-
setPrincipal
void setPrincipal(Principal principal)
-
hasAuthority
boolean hasAuthority(java.lang.String... authorityId)
Check active principal for at least one valid authority.- Parameters:
authorityId-- Returns:
- false if all are invalid
-
requirePrincipal
default void requirePrincipal()
Checks the presence of active valid principal. If not present - throws PrincipalRequiredException
-
requireAuthority
default void requireAuthority(java.lang.String... authorityId)
For the active principal checks the presence of at least one valid authority. If there is not one - throws AuthorityRequiredException- Parameters:
authorityId-
-
-