Package net.solarnetwork.node.runtime
Class DefaultSecurityTokenService
java.lang.Object
net.solarnetwork.service.support.BasicIdentifiable
net.solarnetwork.node.service.support.BaseIdentifiable
net.solarnetwork.node.runtime.DefaultSecurityTokenService
- All Implemented Interfaces:
SecurityTokenService,net.solarnetwork.service.Identifiable
Default implementation of
SecurityTokenService- Since:
- 3.4
- Version:
- 1.0
- Author:
- matt
-
Field Summary
Fields inherited from class net.solarnetwork.node.service.support.BaseIdentifiable
logFields inherited from interface net.solarnetwork.service.Identifiable
GROUP_UID_PROPERTY, UID_PROPERTY -
Constructor Summary
ConstructorsConstructorDescriptionDefaultSecurityTokenService(SecureRandom rng, net.solarnetwork.service.OptionalService<SecurityTokenDao> securityTokenDao) Constructor.DefaultSecurityTokenService(net.solarnetwork.service.OptionalService<SecurityTokenDao> securityTokenDao) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionnet.solarnetwork.domain.KeyValuePaircreateToken(SecurityToken details) Create a new token.voiddeleteToken(String tokenId) Delete a security token.Get all available security tokens.tokenForId(String tokenId) Get a security token for a given ID.voidupdateToken(SecurityToken token) Update the modifiable values of a security token.Methods inherited from class net.solarnetwork.node.service.support.BaseIdentifiable
baseIdentifiableSettings, baseIdentifiableSettings, getExpressionServices, getPlaceholderService, populateExpressionDatumProperties, resolvePlaceholders, resolvePlaceholders, setExpressionServices, setPlaceholderServiceMethods inherited from class net.solarnetwork.service.support.BasicIdentifiable
basicIdentifiableMetadataSettings, basicIdentifiableSettings, basicIdentifiableSettings, basicIdentifiableSettings, doubleMetadataValue, getDisplayName, getGroupUid, getGroupUID, getMessageSource, getMetadata, getMetadataCount, getUid, getUID, integerMetadataValue, metadataValue, numberMetadataValue, saveMetadataValue, saveMetadataValue, setDisplayName, setGroupUid, setGroupUID, setMessageSource, setMetadata, setMetadataCount, setUid, setUID, smartMetadataValueMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.solarnetwork.service.Identifiable
getDisplayName, getGroupUid, getUid
-
Constructor Details
-
DefaultSecurityTokenService
public DefaultSecurityTokenService(net.solarnetwork.service.OptionalService<SecurityTokenDao> securityTokenDao) Constructor.- Parameters:
securityTokenDao- the DAO to use- Throws:
IllegalArgumentException- if any argument is null
-
DefaultSecurityTokenService
public DefaultSecurityTokenService(SecureRandom rng, net.solarnetwork.service.OptionalService<SecurityTokenDao> securityTokenDao) Constructor.- Parameters:
rng- the random number generatorsecurityTokenDao- the DAO to use- Throws:
IllegalArgumentException- if any argument is null
-
-
Method Details
-
getAvailableTokens
Description copied from interface:SecurityTokenServiceGet all available security tokens.The token secrets are not returned by this method.
- Specified by:
getAvailableTokensin interfaceSecurityTokenService- Returns:
- the tokens, never null
-
tokenForId
Description copied from interface:SecurityTokenServiceGet a security token for a given ID.- Specified by:
tokenForIdin interfaceSecurityTokenService- Parameters:
tokenId- the token ID- Returns:
- the token, or null if not found
-
createToken
Description copied from interface:SecurityTokenServiceCreate a new token.This method will generate a new security token and return the generated token ID and secret.
- Specified by:
createTokenin interfaceSecurityTokenService- Parameters:
details- the optional details (name, description) to use- Returns:
- the token ID and token secret
-
updateToken
Description copied from interface:SecurityTokenServiceUpdate the modifiable values of a security token.The token ID and secret cannot be changed by this method, but properties like
nameanddescriptioncan.- Specified by:
updateTokenin interfaceSecurityTokenService- Parameters:
token- the token details to update
-
deleteToken
Description copied from interface:SecurityTokenServiceDelete a security token.No error is thrown if the given
tokenIddoes not exist.- Specified by:
deleteTokenin interfaceSecurityTokenService- Parameters:
tokenId- the ID of the token to delete
-