Class WMTokenBasedAuthenticationService
java.lang.Object
com.wavemaker.runtime.security.token.WMTokenBasedAuthenticationService
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intgenerateToken(org.springframework.security.core.Authentication successfulAuthentication) org.springframework.security.core.AuthenticationgetAuthentication(Token token) booleanprotected StringmakeTokenSignature(long tokenExpiryTime, String username) Calculates the digital signature to be put in the cookie.protected StringretrieveUserName(org.springframework.security.core.Authentication authentication) voidvoidsetTokenValiditySeconds(int tokenValiditySeconds) protected org.springframework.security.core.AuthenticationtoAuthentication(WMUser wmUser) protected WMUsertoWMUser(org.springframework.security.core.Authentication authentication)
-
Field Details
-
DEFAULT_VALIDITY_SECONDS
public static final int DEFAULT_VALIDITY_SECONDS- See Also:
-
DEFAULT_KEY
- See Also:
-
-
Constructor Details
-
WMTokenBasedAuthenticationService
public WMTokenBasedAuthenticationService() -
WMTokenBasedAuthenticationService
public WMTokenBasedAuthenticationService(int tokenValiditySeconds)
-
-
Method Details
-
generateToken
public Token generateToken(org.springframework.security.core.Authentication successfulAuthentication) -
getAuthentication
-
setTokenValiditySeconds
public void setTokenValiditySeconds(int tokenValiditySeconds) -
getParameter
-
setKey
-
isEnabled
public boolean isEnabled() -
toWMUser
-
toAuthentication
-
retrieveUserName
-
calculateLoginLifetime
protected int calculateLoginLifetime() -
makeTokenSignature
Calculates the digital signature to be put in the cookie. Default value is MD5 ("username:tokenExpiryTime:password:key")
-