Package org.dspace.app.rest
Class AuthenticationRestController
- java.lang.Object
-
- org.dspace.app.rest.AuthenticationRestController
-
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean
@RequestMapping("/api/authn") @RestController public class AuthenticationRestController extends Object implements org.springframework.beans.factory.InitializingBeanRest controller that handles authentication on the REST API together with the Spring Security filters configured inWebSecurityConfiguration- Author:
- Frederic Van Reet (frederic dot vanreet at atmire dot com), Tom Desair (tom dot desair at atmire dot com)
-
-
Constructor Summary
Constructors Constructor Description AuthenticationRestController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()AuthnResourceauthn()protected org.springframework.http.ResponseEntitygetLoginResponse(javax.servlet.http.HttpServletRequest request, String failedMessage)org.springframework.http.ResponseEntitylogin()org.springframework.http.ResponseEntitylogin(javax.servlet.http.HttpServletRequest request, String user, String password)org.springframework.http.ResponseEntitylogout()AuthenticationTokenResourceshortLivedToken(javax.servlet.http.HttpServletRequest request)This method will generate a short lived token to be used for bitstream downloads among other things.AuthenticationStatusResourcestatus(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
-
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
authn
@RequestMapping(method=GET) public AuthnResource authn()
-
status
@RequestMapping(value="/status", method=GET) public AuthenticationStatusResource status(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws SQLException- Throws:
SQLException
-
login
@RequestMapping(value="/login", method=POST) public org.springframework.http.ResponseEntity login(javax.servlet.http.HttpServletRequest request, @RequestParam(name="user",required=false) String user, @RequestParam(name="password",required=false) String password)
-
shortLivedToken
@PreAuthorize("hasAuthority(\'AUTHENTICATED\')") @RequestMapping(value="/shortlivedtokens", method=POST) public AuthenticationTokenResource shortLivedToken(javax.servlet.http.HttpServletRequest request)This method will generate a short lived token to be used for bitstream downloads among other things. curl -v -X POST https://{dspace-server.url}/api/authn/shortlivedtokens -H "Authorization: Bearer eyJhbG...COdbo" Example:curl -v -X POST https://{dspace-server.url}/api/authn/shortlivedtokens -H "Authorization: Bearer eyJhbG...COdbo"- Parameters:
request- The StandardMultipartHttpServletRequest- Returns:
- The created short lived token
-
login
@RequestMapping(value="/login", method={GET,PUT,PATCH,DELETE}) public org.springframework.http.ResponseEntity login()
-
logout
@RequestMapping(value="/logout", method={GET,POST}) public org.springframework.http.ResponseEntity logout()
-
getLoginResponse
protected org.springframework.http.ResponseEntity getLoginResponse(javax.servlet.http.HttpServletRequest request, String failedMessage)
-
-