Class DynamicPropertyPublicKey
java.lang.Object
com.broadleafcommerce.auth.user.autoconfigure.support.keys.AbstractDynamicPropertyKey<RSAPublicKey>
com.broadleafcommerce.auth.user.autoconfigure.support.keys.DynamicPropertyPublicKey
- All Implemented Interfaces:
Serializable,RSAKey,RSAPublicKey,Key,PublicKey
public class DynamicPropertyPublicKey
extends AbstractDynamicPropertyKey<RSAPublicKey>
implements RSAPublicKey
This is a special 'smart key' bean that will always present the latest public key for
AuthenticationServices based on
AuthorizationServerProperties.OAuth2.getEncodedPublicKey(). The only exception is when
this key is used multiple times in a request lifecycle - in that case, the 'latest' value is
computed in the first use of this key, and then that value is used for the remainder of that
request's lifecycle.-
Field Summary
Fields inherited from interface java.security.interfaces.RSAPublicKey
serialVersionUID -
Constructor Summary
ConstructorsConstructorDescriptionDynamicPropertyPublicKey(AuthorizationServerProperties authorizationServerProperties) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanatomicSetKeyInRequestContextIfUnset(RSAPublicKey key, DynamicPropertyKeysRequestContext requestContext) Implementations must be atomic and only set the given key instance value in the request context if unset.protected RSAPublicKeyconstructKeyInstance(String rawKeyValue) Note - if this implementation changes, it's important to also ensure the interface declared at the top of this class is made as specific as possible to match.protected AuthorizationServerPropertiesbyte[]protected RSAPublicKeygetExistingKeyFromRequestContext(DynamicPropertyKeysRequestContext requestContext) protected StringAuthorizationServerPropertieswill always contain the latest refreshed property value.protected org.slf4j.LoggergetLog()Methods inherited from class com.broadleafcommerce.auth.user.autoconfigure.support.keys.AbstractDynamicPropertyKey
getDelegate, getDynamicPropertyKeysRequestContext, getOrComputeKeyFromRequestContext, getOrComputeLatestKeyFromProperties, setDynamicPropertyKeysRequestContext
-
Constructor Details
-
DynamicPropertyPublicKey
-
-
Method Details
-
getLog
protected org.slf4j.Logger getLog()- Specified by:
getLogin classAbstractDynamicPropertyKey<RSAPublicKey>- Returns:
- the logger that should be used for log messages
-
getExistingKeyFromRequestContext
@Nullable protected RSAPublicKey getExistingKeyFromRequestContext(DynamicPropertyKeysRequestContext requestContext) - Specified by:
getExistingKeyFromRequestContextin classAbstractDynamicPropertyKey<RSAPublicKey>- Parameters:
requestContext- the request context from which to get the existing key instance- Returns:
- the existing key instance in the request context, or
nullif none is set
-
atomicSetKeyInRequestContextIfUnset
protected boolean atomicSetKeyInRequestContextIfUnset(RSAPublicKey key, DynamicPropertyKeysRequestContext requestContext) Description copied from class:AbstractDynamicPropertyKeyImplementations must be atomic and only set the given key instance value in the request context if unset.Recommended to use
AtomicReference.compareAndSet(Object, Object)semantics.- Specified by:
atomicSetKeyInRequestContextIfUnsetin classAbstractDynamicPropertyKey<RSAPublicKey>- Parameters:
key- the key value to set in the request contextrequestContext- the request context in which to set the value- Returns:
- true if the update succeeded (only set if unset), false otherwise
-
getLatestPropertyValueForKey
AuthorizationServerPropertieswill always contain the latest refreshed property value.- Specified by:
getLatestPropertyValueForKeyin classAbstractDynamicPropertyKey<RSAPublicKey>- Returns:
- the latest property value for
AuthorizationServerProperties.OAuth2.getEncodedPublicKey()
-
constructKeyInstance
Note - if this implementation changes, it's important to also ensure the interface declared at the top of this class is made as specific as possible to match. This ensures things likeinstanceofchecks against this class (ex: such as those done inRSAKey) will go through the right code flows based on the specific interface type.- Specified by:
constructKeyInstancein classAbstractDynamicPropertyKey<RSAPublicKey>- Parameters:
rawKeyValue- the raw key value to construct the instance from- Returns:
- the constructed key instance
-
getPublicExponent
- Specified by:
getPublicExponentin interfaceRSAPublicKey
-
getAlgorithm
- Specified by:
getAlgorithmin interfaceKey
-
getFormat
-
getEncoded
public byte[] getEncoded()- Specified by:
getEncodedin interfaceKey
-
getModulus
- Specified by:
getModulusin interfaceRSAKey
-
getParams
-
getAuthorizationServerProperties
-