Package systems.dennis.auth.client.utils
Class SecurityUtils
java.lang.Object
systems.dennis.auth.client.utils.SecurityUtils
- All Implemented Interfaces:
systems.dennis.shared.annotations.security.ISecurityUtils<Long>
-
Field Summary
Fields inherited from interface systems.dennis.shared.annotations.security.ISecurityUtils
USER_ID_FIELD -
Method Summary
Modifier and TypeMethodDescriptionbooleananyRole()voidcheckSubscription(List<String> possibleSubscriptions) get()get2factorBarCodeForUser(LoginPasswordService loginPasswordService) getGoogleAuthenticatorBarCode(String secretKey, String account, String issuer) getLoginData(LoginPasswordService service) systems.dennis.shared.entity.TokenDatagetToken()systems.dennis.shared.entity.TokenDataReturns a token from requestsystems.dennis.shared.entity.TokenDatagetTOTPCode(LoginPasswordService service, String login) booleanbooleanisAdmin()voidvoidvoidstatic StringMasks a string withing half of its symbolsvoidbooleanroleExists(String... roles) voidroleExistsOrThrow(String... roles) roles()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface systems.dennis.shared.annotations.security.ISecurityUtils
belongsToMeQuery, belongsToMeSpecification
-
Method Details
-
mask
Masks a string withing half of its symbols- Parameters:
token- a String to mask- Returns:
- a masked string
-
isAdmin
public boolean isAdmin()- Specified by:
isAdminin interfacesystems.dennis.shared.annotations.security.ISecurityUtils<Long>
-
hasRole
- Specified by:
hasRolein interfacesystems.dennis.shared.annotations.security.ISecurityUtils<Long>
-
getUserLanguage
- Specified by:
getUserLanguagein interfacesystems.dennis.shared.annotations.security.ISecurityUtils<Long>
-
removeLocalAuthorization
public void removeLocalAuthorization() -
get
- Throws:
systems.dennis.shared.exceptions.AuthorizationNotFoundException
-
getUserDataId
- Specified by:
getUserDataIdin interfacesystems.dennis.shared.annotations.security.ISecurityUtils<Long>
-
checkSubscription
-
tokenFromHeader
public UserTokenDTO tokenFromHeader() throws systems.dennis.shared.exceptions.AuthorizationNotFoundException- Throws:
systems.dennis.shared.exceptions.AuthorizationNotFoundException
-
generateSecretKey
-
get2factorBarCodeForUser
-
getLoginData
-
getGoogleAuthenticatorBarCode
-
getTOTPCode
-
getTOTPCode
-
getTokenFromRequest
public systems.dennis.shared.entity.TokenData getTokenFromRequest() throws systems.dennis.shared.exceptions.AuthorizationNotFoundExceptionReturns a token from request- Returns:
- string value or null
- Throws:
systems.dennis.shared.exceptions.AuthorizationNotFoundException
-
getTokenOrThrow
public systems.dennis.shared.entity.TokenData getTokenOrThrow() throws systems.dennis.shared.exceptions.AuthorizationNotFoundException, systems.dennis.shared.exceptions.AuthorizationNotFoundException- Returns:
- Throws:
systems.dennis.shared.exceptions.AuthorizationNotFoundException
-
userOrThrow
public UserData userOrThrow() throws systems.dennis.shared.exceptions.AuthorizationNotFoundException- Throws:
systems.dennis.shared.exceptions.AuthorizationNotFoundException
-
roles
- Throws:
systems.dennis.shared.exceptions.AuthorizationNotFoundException
-
roleExists
public boolean roleExists(String... roles) throws systems.dennis.shared.exceptions.AuthorizationNotFoundException - Throws:
systems.dennis.shared.exceptions.AuthorizationNotFoundException
-
roleExistsOrThrow
public void roleExistsOrThrow(String... roles) throws systems.dennis.shared.exceptions.AuthorizationNotFoundException - Throws:
systems.dennis.shared.exceptions.AuthorizationNotFoundException
-
anyRole
public boolean anyRole() -
isMe
-
getToken
public systems.dennis.shared.entity.TokenData getToken()- Specified by:
getTokenin interfacesystems.dennis.shared.annotations.security.ISecurityUtils<Long>
-
isMy
- Specified by:
isMyin interfacesystems.dennis.shared.annotations.security.ISecurityUtils<Long>
-