Package org.mycore.restapi.v1
Class MCRRestAPIAuthentication
java.lang.Object
org.mycore.restapi.v1.MCRRestAPIAuthentication
Rest Controller that handles authentication.
- Author:
- Thomas Scheffler, Robert Stephan
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionjakarta.ws.rs.core.Response
Unauthenticated requests should return a response whose header contains a HTTP 401 Unauthorized status and a WWW-Authenticate field. 200 OK Content-Type: application/json;charset=UTF-8 { "access_token": "NgCXRK...MzYjw", "token_type": "Bearer", "expires_at": 1372700873, "refresh_token": "NgAagA...Um_SHo" } Returning the JWT (Java Web Token to the client is not properly specified).getToken
(MCRSession session, String remoteIp) jakarta.ws.rs.core.Response
static void
-
Field Details
-
AUDIENCE
- See Also:
-
-
Constructor Details
-
MCRRestAPIAuthentication
public MCRRestAPIAuthentication()
-
-
Method Details
-
authorize
@GET @Produces("application/json;charset=utf-8") @Path("/login") public jakarta.ws.rs.core.Response authorize(@DefaultValue("") @HeaderParam("Authorization") String authorization) throws IOException Unauthenticated requests should return a response whose header contains a HTTP 401 Unauthorized status and a WWW-Authenticate field. 200 OK Content-Type: application/json;charset=UTF-8 { "access_token": "NgCXRK...MzYjw", "token_type": "Bearer", "expires_at": 1372700873, "refresh_token": "NgAagA...Um_SHo" } Returning the JWT (Java Web Token to the client is not properly specified). We use the "Authorization" Header in the response, which is unusual but not strictly forbidden.- Parameters:
authorization
- - content HTTP Header Authorization- Returns:
- response message as JSON
- Throws:
IOException
- if JWT cannot be written
-
getToken
-
renew
@GET @Path("/renew") public jakarta.ws.rs.core.Response renew(@DefaultValue("") @HeaderParam("Authorization") String authorization) throws IOException - Throws:
IOException
-
validate
- Throws:
com.auth0.jwt.exceptions.JWTVerificationException
-