Class MockAuthorizationServiceImpl
java.lang.Object
ch.admin.bag.covidcertificate.authorization.impl.MockAuthorizationServiceImpl
- All Implemented Interfaces:
AuthorizationService
@Service
@Profile("mock-authorization && !authorization")
public class MockAuthorizationServiceImpl
extends Object
implements AuthorizationService
The mock implementation of AuthorizationService used if the profile AUTHORIZATION_MOCK is active.
-
Field Summary
Fields inherited from interface ch.admin.bag.covidcertificate.authorization.AuthorizationService
SERVICE_API_GATEWAY, SERVICE_MANAGEMENT, SERVICE_NOTIFICATIONS, SERVICE_REPORT, SERVICE_WEB_UI -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetCurrent(String service, List<String> rawRoles) Returns all permitted functions by given roles at given service.getDefinition(String service) Returns the definition of given service.Returns the role mapping.identifyFunction(String service, String uri, String httpMethod) Returns a list of ServiceData.Function that match given uri and http method.booleanisGranted(Set<String> rawRoles, ServiceData.Function function) Returnstruefor given function if the one-of setting contains the role needed for the function to be accessed.booleanisUserPermitted(Collection<String> rawRoles) Returnstrueif the user based upon his roles is permitted to generally use the application.mapRawRoles(Collection<String> rawRoles) Returns a set with the role names as expected by the ServiceData.Function.
-
Constructor Details
-
MockAuthorizationServiceImpl
public MockAuthorizationServiceImpl()
-
-
Method Details
-
getCurrent
Description copied from interface:AuthorizationServiceReturns all permitted functions by given roles at given service. This permission is bound to time and may change during time.- Specified by:
getCurrentin interfaceAuthorizationService- Parameters:
service- the requesting servicerawRoles- the current roles of the user (either from eIAM or from Claim)- Returns:
- set of permitted functions
-
getDefinition
Description copied from interface:AuthorizationServiceReturns the definition of given service.- Specified by:
getDefinitionin interfaceAuthorizationService- Parameters:
service- the requesting service- Returns:
- the service's definition
-
getRoleMapping
Description copied from interface:AuthorizationServiceReturns the role mapping.Roles consist of different perspectives. The mapping aligns them:
claim= role name used in JWT tokenseiam= role name used in eIAMintern= role name used in this libraries function permissions
- Specified by:
getRoleMappingin interfaceAuthorizationService- Returns:
- the mapping for the supported roles
-
isUserPermitted
Description copied from interface:AuthorizationServiceReturnstrueif the user based upon his roles is permitted to generally use the application.- Specified by:
isUserPermittedin interfaceAuthorizationService- Parameters:
rawRoles- the current roles of the user (either from eIAM or from Claim)- Returns:
trueif permitted, otherwisefalse
-
identifyFunction
Description copied from interface:AuthorizationServiceReturns a list of ServiceData.Function that match given uri and http method.A single entry is a trustful identification, more or less than that indicates that the identification is NOT trustworthy.
- Specified by:
identifyFunctionin interfaceAuthorizationService- Parameters:
service- identifies the current serviceuri- the uri the function has to matchhttpMethod- the http method the function has to match- Returns:
- List of ServiceData.Function that match given uri and http method
-
isGranted
Description copied from interface:AuthorizationServiceReturnstruefor given function if the one-of setting contains the role needed for the function to be accessed. If one-of isn't configured false will be returned.- Specified by:
isGrantedin interfaceAuthorizationService- Parameters:
rawRoles- the current roles of the user (either from eIAM or from Claim)function- the function to check- Returns:
truefor given function if the one-of setting contains the role needed for the function to be accessed. If one-of isn't configured false will be returned.
-
mapRawRoles
Description copied from interface:AuthorizationServiceReturns a set with the role names as expected by the ServiceData.Function.- Specified by:
mapRawRolesin interfaceAuthorizationService- Parameters:
rawRoles- the current roles of the user (either from eIAM or from Claim)- Returns:
- set with role names
-