Class TokenManagerService
java.lang.Object
de.joergdev.mosy.backend.security.TokenManagerService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcreateToken(int hash, Integer tenantId, Integer hashForTenant, IntSupplier defaultTenantIdForNonMultiTanencySupplier) Creates a new token.static StringcreateTokenWithoutSecretCheck(Integer tenantId, IntSupplier defaultTenantIdForNonMultiTanencySupplier) Creates a new token WITHOUT check of secret key. !!static IntegergetTenantId(String token) static booleaninvalidateToken(String token) static booleanvalidateToken(String token)
-
Constructor Details
-
TokenManagerService
public TokenManagerService()
-
-
Method Details
-
createToken
public static String createToken(int hash, Integer tenantId, Integer hashForTenant, IntSupplier defaultTenantIdForNonMultiTanencySupplier) Creates a new token.- Parameters:
hash- - hashcode of secrettenantId- - may be null if multi-tanency is not enabledhashForTenant- - hashcode of secret for tenant (may be null if multi-tanency is not enabled)defaultTenantIdForNonMultiTanencySupplier- - IntSupplier for resolving the default-tenantId (non-multi-tanency)- Returns:
- null on invalid credentials else valid token
-
createTokenWithoutSecretCheck
public static String createTokenWithoutSecretCheck(Integer tenantId, IntSupplier defaultTenantIdForNonMultiTanencySupplier) Creates a new token WITHOUT check of secret key. !!ATTENTION!! This may only be used for internal use cases. This token should never be delivered to a client!
- Parameters:
tenantId- - IDdefaultTenantIdForNonMultiTanencySupplier- - IntSupplier for resolving the default-tenantId (non-multi-tanency)- Returns:
- null on invalid credentials else valid token
-
validateToken
-
invalidateToken
-
getTenantId
-