Package org.dspace.app.rest.security.jwt
Class JWTTokenRestAuthenticationServiceImpl
- java.lang.Object
-
- org.dspace.app.rest.security.jwt.JWTTokenRestAuthenticationServiceImpl
-
- All Implemented Interfaces:
RestAuthenticationService,org.springframework.beans.factory.InitializingBean
@Component public class JWTTokenRestAuthenticationServiceImpl extends Object implements RestAuthenticationService, org.springframework.beans.factory.InitializingBean
Rest Authentication implementation for JSON Web Tokens- Author:
- Frederic Van Reet (frederic dot vanreet at atmire dot com), Tom Desair (tom dot desair at atmire dot com), Giuseppe Digilio (giuseppe dot digilio at 4science dot it)
-
-
Constructor Summary
Constructors Constructor Description JWTTokenRestAuthenticationServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAuthenticationDataForUser(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, DSpaceAuthentication authentication, boolean addCookie)voidafterPropertiesSet()org.dspace.eperson.EPersongetAuthenticatedEPerson(javax.servlet.http.HttpServletRequest request, org.dspace.core.Context context)org.dspace.authenticate.service.AuthenticationServicegetAuthenticationService()AuthenticationTokengetShortLivedAuthenticationToken(org.dspace.core.Context context, javax.servlet.http.HttpServletRequest request)Create a short-lived token for bitstream downloads among other thingsStringgetWwwAuthenticateHeaderValue(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Return the value that should be passed in the WWWW-Authenticate header for 4xx responses to the clientbooleanhasAuthenticationData(javax.servlet.http.HttpServletRequest request)voidinvalidateAuthenticationCookie(javax.servlet.http.HttpServletResponse response)voidinvalidateAuthenticationData(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.dspace.core.Context context)
-
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet() throws Exception- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
addAuthenticationDataForUser
public void addAuthenticationDataForUser(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, DSpaceAuthentication authentication, boolean addCookie) throws IOException- Specified by:
addAuthenticationDataForUserin interfaceRestAuthenticationService- Throws:
IOException
-
getShortLivedAuthenticationToken
public AuthenticationToken getShortLivedAuthenticationToken(org.dspace.core.Context context, javax.servlet.http.HttpServletRequest request)
Create a short-lived token for bitstream downloads among other things- Specified by:
getShortLivedAuthenticationTokenin interfaceRestAuthenticationService- Parameters:
context- The context for which to create the tokenrequest- The request for which to create the token- Returns:
- The token with a short lifespan
-
getAuthenticatedEPerson
public org.dspace.eperson.EPerson getAuthenticatedEPerson(javax.servlet.http.HttpServletRequest request, org.dspace.core.Context context)- Specified by:
getAuthenticatedEPersonin interfaceRestAuthenticationService
-
hasAuthenticationData
public boolean hasAuthenticationData(javax.servlet.http.HttpServletRequest request)
- Specified by:
hasAuthenticationDatain interfaceRestAuthenticationService
-
invalidateAuthenticationData
public void invalidateAuthenticationData(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.dspace.core.Context context) throws Exception- Specified by:
invalidateAuthenticationDatain interfaceRestAuthenticationService- Throws:
Exception
-
invalidateAuthenticationCookie
public void invalidateAuthenticationCookie(javax.servlet.http.HttpServletResponse response)
- Specified by:
invalidateAuthenticationCookiein interfaceRestAuthenticationService
-
getAuthenticationService
public org.dspace.authenticate.service.AuthenticationService getAuthenticationService()
- Specified by:
getAuthenticationServicein interfaceRestAuthenticationService
-
getWwwAuthenticateHeaderValue
public String getWwwAuthenticateHeaderValue(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Description copied from interface:RestAuthenticationServiceReturn the value that should be passed in the WWWW-Authenticate header for 4xx responses to the client- Specified by:
getWwwAuthenticateHeaderValuein interfaceRestAuthenticationService- Parameters:
request- The current client requestresponse- The response being build for the client- Returns:
- A string value that should be set in the WWWW-Authenticate header
-
-