Class WMTokenBasedAuthenticationService

java.lang.Object
com.wavemaker.runtime.security.token.WMTokenBasedAuthenticationService

public class WMTokenBasedAuthenticationService extends Object
Generate Token encoded by this implementation adopts the following form:
 username + ":" + expiryTime + ":" + Md5Hex(username + ":" + expiryTime + ":" + password + ":" + key)
 

Persist generated token with authentication in repository.And if any request comes with auth token which is there in repository,then authentication retrieved from repository instead of hitting to its providers again.

InMemoryPersistentAuthTokenRepository which is used to persist token and authentication in memory. It is recommended to persist token in repository.

Since:
7/2/16
  • Field Details

  • Constructor Details

    • WMTokenBasedAuthenticationService

      public WMTokenBasedAuthenticationService()
    • WMTokenBasedAuthenticationService

      public WMTokenBasedAuthenticationService(int tokenValiditySeconds)
  • Method Details

    • generateToken

      public Token generateToken(org.springframework.security.core.Authentication successfulAuthentication)
    • getAuthentication

      public org.springframework.security.core.Authentication getAuthentication(Token token)
    • setTokenValiditySeconds

      public void setTokenValiditySeconds(int tokenValiditySeconds)
    • getParameter

      public String getParameter()
    • setKey

      public void setKey(String key)
    • isEnabled

      public boolean isEnabled()
    • toWMUser

      protected WMUser toWMUser(org.springframework.security.core.Authentication authentication)
    • toAuthentication

      protected org.springframework.security.core.Authentication toAuthentication(WMUser wmUser)
    • retrieveUserName

      protected String retrieveUserName(org.springframework.security.core.Authentication authentication)
    • calculateLoginLifetime

      protected int calculateLoginLifetime()
    • makeTokenSignature

      protected String makeTokenSignature(long tokenExpiryTime, String username)
      Calculates the digital signature to be put in the cookie. Default value is MD5 ("username:tokenExpiryTime:password:key")