Package de.dlr.proseo.api.prip
Klasse ProductionInterfaceSecurity
java.lang.Object
de.dlr.proseo.api.prip.ProductionInterfaceSecurity
Security utility methods for PRIP API
- Autor:
- Dr. Thomas Bassler
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibung(Package privat) OAuth2TokenManager.UserInfo
authenticateUser
(OAuth2TokenManager.UserInfo userInfo) Check user credentials and authorities with User Managervoid
doLogin
(javax.servlet.http.HttpServletRequest request) Log in to prosEOGets the authorities granted to the user after loginGets the code of the mission the current user is logged in toGets the password of the logged in usergetUser()
Gets the name of the logged in user for service authentication (including mission prefix)boolean
hasRole
(de.dlr.proseo.model.enums.UserRole role) Checks whether the logged in user has the given role(Package privat) OAuth2TokenManager.UserInfo
parseAuthenticationHeader
(String authHeader) Parse an HTTP authentication header into mission, username and password and set the respective thread-local attributes
-
Konstruktordetails
-
ProductionInterfaceSecurity
public ProductionInterfaceSecurity()
-
-
Methodendetails
-
parseAuthenticationHeader
OAuth2TokenManager.UserInfo parseAuthenticationHeader(String authHeader) throws IllegalArgumentException Parse an HTTP authentication header into mission, username and password and set the respective thread-local attributes- Parameter:
authHeader
- the authentication header to parse, expected format: "Basic base64(mission\username:password)"- Gibt zurück:
- the parsed UserInfo
- Löst aus:
IllegalArgumentException
- if the authentication header cannot be parsed into the three parts expected
-
doLogin
Log in to prosEO- Parameter:
request
- the HTTP request containing the authentication header- Löst aus:
SecurityException
- if the login failed for any reason
-
authenticateUser
OAuth2TokenManager.UserInfo authenticateUser(OAuth2TokenManager.UserInfo userInfo) throws SecurityException Check user credentials and authorities with User Manager- Parameter:
userInfo
- a UserInfo object containing the user credentials- Gibt zurück:
- the updated UserInfo object including authorities, if the authentication was successful and PRIP access is granted
- Löst aus:
SecurityException
- if the user could not be authenticated or is not authorized to access the PRIP API
-
getUser
Gets the name of the logged in user for service authentication (including mission prefix)- Gibt zurück:
- the user name or null, if no user is logged in
-
getPassword
Gets the password of the logged in user- Gibt zurück:
- the password or null, if no user is logged in
-
getMission
Gets the code of the mission the current user is logged in to- Gibt zurück:
- the mission code or null, if no user is logged in
-
getAuthorities
Gets the authorities granted to the user after login- Gibt zurück:
- the granted authorities
-
hasRole
public boolean hasRole(de.dlr.proseo.model.enums.UserRole role) Checks whether the logged in user has the given role- Parameter:
role
- the user role to check- Gibt zurück:
- true, if the respective authority was granted, false otherwise
-