Package io.jmix.webdavrest.security
Class CookieAuthenticationRegistry
java.lang.Object
io.jmix.webdavrest.security.CookieAuthenticationRegistry
Manages both types of tokens (URl, Cookie) being used for cookie auth method.
-
Field Summary
Modifier and TypeFieldDescriptionprotected CookieAuthTokenObjectRepository
protected CookieAuthUrlTokenObjectRepository
protected UserRepository
protected WebdavProperties
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionacquireCookieTokenByUrlToken
(String urlTokenValue) Generates cookie-token object based on valid URL-token value.protected String
Generates new URL-token based on currently authenticated session.protected String
getPrincipalByCookieToken
(String tokenValue) Extracts UserDetails by cookie-token value.boolean
isCookieTokenValid
(String tokenValue) Validates cookie-token according to existence and expiration time.boolean
isUrlTokenValid
(String tokenValue) Validates URL-token.
-
Field Details
-
userRepository
-
cookieAuthUrlTokenObjectRepository
-
cookieAuthTokenObjectRepository
-
webdavProperties
-
-
Constructor Details
-
CookieAuthenticationRegistry
public CookieAuthenticationRegistry()
-
-
Method Details
-
isUrlTokenValid
Validates URL-token. URL-token is a one-time short-term token, so it's valid if it exists.- Parameters:
tokenValue
- token value extracted from request URL- Returns:
- true if token is valid, false otherwise
-
isCookieTokenValid
Validates cookie-token according to existence and expiration time.- Parameters:
tokenValue
- token value extracted from cookie- Returns:
- true if token is valid, false otherwise
-
getPrincipalByCookieToken
Extracts UserDetails by cookie-token value. Username is linked with cookie-token value during its generation- Parameters:
tokenValue
- token value extracted from cookie- Returns:
- principal object
-
generateUrlToken
Generates new URL-token based on currently authenticated session.- Returns:
- URL-token value
-
acquireCookieTokenByUrlToken
Generates cookie-token object based on valid URL-token value. Provided URL-token will be invalidated after that.- Parameters:
urlTokenValue
- token value extracted from url- Returns:
- new cookie-token object.
-
generateUrlTokenValue
-
generateCookieTokenValue
-