Class AuthenticationRestController

  • All Implemented Interfaces:
    org.springframework.beans.factory.InitializingBean

    @RequestMapping("/api/authn")
    @RestController
    public class AuthenticationRestController
    extends Object
    implements org.springframework.beans.factory.InitializingBean
    Rest controller that handles authentication on the REST API together with the Spring Security filters configured in WebSecurityConfiguration
    Author:
    Frederic Van Reet (frederic dot vanreet at atmire dot com), Tom Desair (tom dot desair at atmire dot com)
    • Constructor Detail

      • AuthenticationRestController

        public AuthenticationRestController()
    • Method Detail

      • afterPropertiesSet

        public void afterPropertiesSet()
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      • authn

        @RequestMapping(method=GET)
        public AuthnResource authn()
      • 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)