Package de.dlr.proseo.api.prip
Klasse OAuth2TokenManager
java.lang.Object
de.dlr.proseo.api.prip.OAuth2TokenManager
Class for managing OAuth2 tokens and to access user information based on OAuth2 tokens
- Autor:
- Dr. Thomas Bassler
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifizierer und TypKlasseBeschreibungstatic class
Information about a user including cached password for authentication with prosEO backend services and authorities to determine access rights to product classes depending on their visibility -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibunggetToken
(String grantType, String username, String password, org.springframework.http.HttpHeaders headers) (Package privat) OAuth2TokenManager.UserInfo
Gets the user information for the given usernamegetUserInfoFromToken
(String token) Analyze a given OAuth2 token (JSON Web Token format) and return the user information associated with the token
-
Konstruktordetails
-
OAuth2TokenManager
public OAuth2TokenManager()
-
-
Methodendetails
-
getUser
Gets the user information for the given username- Parameter:
username
- the username (format <mission>\<user>) to check- Gibt zurück:
- a UserInfo object or null, if no entry for the given username exists
-
getToken
public OAuth2Response getToken(String grantType, String username, String password, org.springframework.http.HttpHeaders headers) throws IllegalArgumentException, UnsupportedOperationException, SecurityException - Parameter:
grantType
- type of grant requested (value must be set to "password" for "Resource Owner Password Credentials Grant" flow or to "client_credentials" for "Client Credentials Grant" flow as per RFC 6749; REQUIRED)username
- the PRIP username (as per RFC 6749; REQUIRED for "Resource Owner Password Credentials Grant" flow, must not be set otherwise)password
- the PRIP password (as per RFC 6749; REQUIRED for "Resource Owner Password Credentials Grant" flow, must not be set otherwise)headers
- the HTTP request headers (for extraction of the Authentication header)- Gibt zurück:
- an OAuth2 token grant response
- Löst aus:
IllegalArgumentException
- if the request is missing a required parameter, includes an unsupported parameter value (other than grant type), repeats a parameter, includes multiple credentials, utilizes more than one mechanism for authenticating the client, or is otherwise malformed.UnsupportedOperationException
- if the authorization grant type is not supported by the PRIP serviceSecurityException
- if the authenticated client is not authorized to use this authorization grant type
-
getUserInfoFromToken
Analyze a given OAuth2 token (JSON Web Token format) and return the user information associated with the token- Parameter:
token
- the OAuth2 token to analyze- Gibt zurück:
- the UserInfo object associated with this token
- Löst aus:
SecurityException
- if the token cannot be associated with a user or is expired
-