Class DSpaceAuthentication

java.lang.Object
org.dspace.app.rest.security.DSpaceAuthentication
All Implemented Interfaces:
Serializable, Principal, org.springframework.security.core.Authentication

public class DSpaceAuthentication extends Object implements org.springframework.security.core.Authentication
Custom Authentication for use with DSpace
Author:
Frederic Van Reet (frederic dot vanreet at atmire dot com), Tom Desair (tom dot desair at atmire dot com)
See Also:
  • Constructor Details

    • DSpaceAuthentication

      public DSpaceAuthentication(EPerson ePerson, List<org.springframework.security.core.GrantedAuthority> authorities)
      Create a DSpaceAuthentication instance for an already authenticated EPerson, including their GrantedAuthority objects.

      NOTE: This type of DSpaceAuthentication object is returned to Spring after a successful authentication.

      Parameters:
      ePerson - authenticated EPerson
      authorities - EPerson's authorities
    • DSpaceAuthentication

      public DSpaceAuthentication(String username, String password)
      Create a temporary DSpaceAuthentication instance which may be used to store information about the user who will be attempting authentication.

      NOTE: This type of DSpaceAuthentication object is used to attempt a new authentication in DSpace. It is therefore temporary in nature, as it will be discarded after successful authentication.

      Parameters:
      username - username to attempt authentication for
      password - password to use for authentication
    • DSpaceAuthentication

      public DSpaceAuthentication()
      Create a temporary, empty DSpaceAuthentication instance which may be used to trigger an implicit authentication. An example is Shibboleth, as this doesn't require an explicit username/password, as the user will have been authenticated externally, and DSpace just needs to perform an implicit authentication by looking for the auth data passed to it by Shibboleth.
  • Method Details

    • getAuthorities

      public Collection<? extends org.springframework.security.core.GrantedAuthority> getAuthorities()
      Specified by:
      getAuthorities in interface org.springframework.security.core.Authentication
    • getCredentials

      public Object getCredentials()
      Specified by:
      getCredentials in interface org.springframework.security.core.Authentication
    • getDetails

      public Object getDetails()
      Specified by:
      getDetails in interface org.springframework.security.core.Authentication
    • getPrincipal

      public Object getPrincipal()
      Specified by:
      getPrincipal in interface org.springframework.security.core.Authentication
    • isAuthenticated

      public boolean isAuthenticated()
      Specified by:
      isAuthenticated in interface org.springframework.security.core.Authentication
    • setAuthenticated

      public void setAuthenticated(boolean authenticated) throws IllegalArgumentException
      Specified by:
      setAuthenticated in interface org.springframework.security.core.Authentication
      Throws:
      IllegalArgumentException
    • getName

      public String getName()
      Specified by:
      getName in interface Principal
    • getPreviousLoginDate

      public Date getPreviousLoginDate()