Package org.jboss.as.controller.security
Class CredentialReference
java.lang.Object
org.jboss.as.controller.security.CredentialReference
Utility class holding attribute definitions for credential-reference attribute in the model.
The class is unifying access to credentials defined through
CredentialStore.
It defines credential-reference attribute that other subsystems can use to reference external credentials of various
types.- Author:
- Peter Skopek
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringName of a field in the complex credential reference attribute.static final StringName of a field in the complex credential reference attribute.static final StringStandard name of a credential reference attribute.static final StringCapability required by a credential-reference attribute if itsstorefield is configured.static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final RejectAttributeCheckerstatic final Stringstatic final StringName of a field in the complex credential reference attribute.static final StringName of a field in the complex credential reference attribute.static final String -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanapplyCredentialReferenceUpdateToRuntime(OperationContext context, org.jboss.dmr.ModelNode operation, org.jboss.dmr.ModelNode resolvedValue, org.jboss.dmr.ModelNode currentValue, String attributeName) static StringcredentialReferencePartAsStringIfDefined(org.jboss.dmr.ModelNode credentialReferenceValue, String name) Utility method to return part ofObjectTypeAttributeDefinitionfor credential reference attribute.getAttributeBuilder(boolean allowNull, boolean referenceCredentialStore) Gets an attribute builder for a credential-reference attribute with the standardcredential-referenceattribute name, a configurable setting as to whether the attribute is required, and optionally configured toregister a requirementfor acredential store capability.getAttributeBuilder(String name, String xmlName, boolean allowNull) Get an attribute builder for a credential-reference attribute with the specified characteristics.getAttributeBuilder(String name, String xmlName, boolean allowNull, boolean referenceCredentialStore) Get an attribute builder for a credential-reference attribute with the specified characteristics, optionally configured toregister a requirementfor acredential store capability.getAttributeBuilder(String name, String xmlName, boolean allowNull, CapabilityReferenceRecorder capabilityStoreReferenceRecorder) Get an attribute builder for a credential-reference attribute with the specified characteristics, optionally configured toAbstractAttributeDefinitionBuilder.setCapabilityReference(CapabilityReferenceRecorder)register a requirement} for acredential store capability.Returns a definition for a credential reference attribute.getAttributeDefinition(boolean referenceCredentialStore) Returns a definition for a credential reference attribute, one that optionallyregisters a requirementfor acredential store capability.static org.wildfly.security.credential.source.CredentialSourcegetCredentialSource(OperationContext context, ObjectTypeAttributeDefinition credentialReferenceAttributeDefinition, org.jboss.dmr.ModelNode model) static ServiceDependency<org.wildfly.security.credential.source.CredentialSource>getCredentialSourceDependency(OperationContext context, AttributeDefinition attribute, org.jboss.dmr.ModelNode model) Returns a service dependency on aCredentialSourceused to obtain a credential referenced by the specified attribute.static ServiceDependency<org.wildfly.security.credential.source.CredentialSource>getCredentialSourceDependency(OperationContext context, AttributeDefinition attribute, org.jboss.dmr.ModelNode model, String keySuffix) Returns a service dependency on aCredentialSourceused to obtain a credential referenced by the specified attribute.static org.wildfly.common.function.ExceptionSupplier<org.wildfly.security.credential.source.CredentialSource,Exception> getCredentialSourceSupplier(OperationContext context, ObjectTypeAttributeDefinition credentialReferenceAttributeDefinition, org.jboss.dmr.ModelNode model, org.jboss.msc.service.ServiceBuilder<?> serviceBuilder) Get the ExceptionSupplier ofCredentialSourcewhich might throw an Exception while getting it.static org.wildfly.common.function.ExceptionSupplier<org.wildfly.security.credential.source.CredentialSource,Exception> getCredentialSourceSupplier(OperationContext context, ObjectTypeAttributeDefinition credentialReferenceAttributeDefinition, org.jboss.dmr.ModelNode model, org.jboss.msc.service.ServiceBuilder<?> serviceBuilder, String keySuffix) Get the ExceptionSupplier ofCredentialSourcewhich might throw an Exception while getting it.static voidhandleCredentialReferenceUpdate(OperationContext context, org.jboss.dmr.ModelNode model) static voidhandleCredentialReferenceUpdate(OperationContext context, org.jboss.dmr.ModelNode credentialReference, String credentialReferenceAttributeName) static voidrollbackCredentialStoreUpdate(AttributeDefinition credentialReferenceAD, OperationContext context, String store, String alias) static voidrollbackCredentialStoreUpdate(AttributeDefinition credentialReferenceAD, OperationContext context, Resource resource) static voidrollbackCredentialStoreUpdate(AttributeDefinition credentialReferenceAD, OperationContext context, org.jboss.dmr.ModelNode resolvedValue)
-
Field Details
-
CREDENTIAL_STORE_CAPABILITY
Capability required by a credential-reference attribute if itsstorefield is configured.- See Also:
-
CREDENTIAL_REFERENCE
Standard name of a credential reference attribute.- See Also:
-
STORE
Name of a field in the complex credential reference attribute.- See Also:
-
ALIAS
Name of a field in the complex credential reference attribute.- See Also:
-
TYPE
Name of a field in the complex credential reference attribute.- See Also:
-
CLEAR_TEXT
Name of a field in the complex credential reference attribute.- See Also:
-
CREDENTIAL_STORE_UPDATE
- See Also:
-
STATUS
- See Also:
-
NEW_ENTRY_ADDED
- See Also:
-
EXISTING_ENTRY_UPDATED
- See Also:
-
NEW_ALIAS
- See Also:
-
UPDATE_ROLLED_BACK
- See Also:
-
KEY_DELIMITER
- See Also:
-
REJECT_CREDENTIAL_REFERENCE_WITH_BOTH_STORE_AND_CLEAR_TEXT
public static final RejectAttributeChecker REJECT_CREDENTIAL_REFERENCE_WITH_BOTH_STORE_AND_CLEAR_TEXT
-
-
Method Details
-
getAttributeDefinition
Returns a definition for a credential reference attribute. Thestorefield in the attribute does not register any requirement for a credential store capability.- Returns:
- credential reference attribute definition
-
getAttributeDefinition
public static ObjectTypeAttributeDefinition getAttributeDefinition(boolean referenceCredentialStore) Returns a definition for a credential reference attribute, one that optionallyregisters a requirementfor acredential store capability. If a requirement is registered, the dependent capability will be the single capability registered by the resource that uses this attribute definition. The resource must expose one and only one capability in order to use this facility.- Parameters:
referenceCredentialStore-trueif thestorefield in the attribute should register a requirement for a credential store capability.- Returns:
- credential reference attribute definition
-
getAttributeBuilder
public static ObjectTypeAttributeDefinition.Builder getAttributeBuilder(boolean allowNull, boolean referenceCredentialStore) Gets an attribute builder for a credential-reference attribute with the standardcredential-referenceattribute name, a configurable setting as to whether the attribute is required, and optionally configured toregister a requirementfor acredential store capability. If a requirement is registered, the dependent capability will be the single capability registered by the resource that uses this attribute definition. The resource must expose one and only one capability in order to use this facility.- Parameters:
allowNull- whether the attribute is requiredreferenceCredentialStore-trueif thestorefield in the attribute should register a requirement for a credential store capability.- Returns:
- an
ObjectTypeAttributeDefinition.Builderwhich can be used to build an attribute definition
-
getAttributeBuilder
public static ObjectTypeAttributeDefinition.Builder getAttributeBuilder(String name, String xmlName, boolean allowNull) Get an attribute builder for a credential-reference attribute with the specified characteristics. Thestorefield in the attribute does not register any requirement for a credential store capability.- Parameters:
name- name of attributexmlName- name of xml elementallowNull-falseif the attribute is required- Returns:
- an
ObjectTypeAttributeDefinition.Builderwhich can be used to build an attribute definition
-
getAttributeBuilder
public static ObjectTypeAttributeDefinition.Builder getAttributeBuilder(String name, String xmlName, boolean allowNull, boolean referenceCredentialStore) Get an attribute builder for a credential-reference attribute with the specified characteristics, optionally configured toregister a requirementfor acredential store capability. If a requirement is registered, the dependent capability will be the single capability registered by the resource that uses this attribute definition. The resource must expose one and only one capability in order to use this facility.- Parameters:
name- name of attributexmlName- name of xml elementallowNull-falseif the attribute is requiredreferenceCredentialStore-trueif thestorefield in the attribute should register a requirement for a credential store capability.- Returns:
- an
ObjectTypeAttributeDefinition.Builderwhich can be used to build an attribute definition
-
getAttributeBuilder
public static ObjectTypeAttributeDefinition.Builder getAttributeBuilder(String name, String xmlName, boolean allowNull, CapabilityReferenceRecorder capabilityStoreReferenceRecorder) Get an attribute builder for a credential-reference attribute with the specified characteristics, optionally configured toAbstractAttributeDefinitionBuilder.setCapabilityReference(CapabilityReferenceRecorder)register a requirement} for acredential store capability.- Parameters:
name- name of attributexmlName- name of xml elementallowNull-falseif the attribute is requiredcapabilityStoreReferenceRecorder- a capability reference recorder that can record a requirement for the credential store referenced by thestorefield of the returned attribute definition. Can benull, in which case no requirement would be recorded. If notnullthe recorder'sbase requirement namemust equalCREDENTIAL_STORE_CAPABILITY- Returns:
- an
ObjectTypeAttributeDefinition.Builderwhich can be used to build attribute definition
-
credentialReferencePartAsStringIfDefined
public static String credentialReferencePartAsStringIfDefined(org.jboss.dmr.ModelNode credentialReferenceValue, String name) throws OperationFailedException Utility method to return part ofObjectTypeAttributeDefinitionfor credential reference attribute.- Parameters:
credentialReferenceValue- value of credential reference attributename- name of part to return (supported names:STOREALIASTYPECLEAR_TEXT- Returns:
- value of part as
String - Throws:
OperationFailedException- when something goes wrong
-
getCredentialSourceDependency
public static ServiceDependency<org.wildfly.security.credential.source.CredentialSource> getCredentialSourceDependency(OperationContext context, AttributeDefinition attribute, org.jboss.dmr.ModelNode model) throws OperationFailedException Returns a service dependency on aCredentialSourceused to obtain a credential referenced by the specified attribute.- Parameters:
context- operation contextattribute- an attribute that references a credentialmodel- a resource model- Returns:
- a
CredentialSourceservice dependency - Throws:
OperationFailedException- if the attribute could not be resolved
-
getCredentialSourceDependency
public static ServiceDependency<org.wildfly.security.credential.source.CredentialSource> getCredentialSourceDependency(OperationContext context, AttributeDefinition attribute, org.jboss.dmr.ModelNode model, String keySuffix) throws OperationFailedException Returns a service dependency on aCredentialSourceused to obtain a credential referenced by the specified attribute.- Parameters:
context- operation contextattribute- an attribute that references a credentialmodel- a resource modelkeySuffix- extra path elements- Returns:
- a
CredentialSourceservice dependency - Throws:
OperationFailedException- if the attribute could not be resolved
-
getCredentialSourceSupplier
public static org.wildfly.common.function.ExceptionSupplier<org.wildfly.security.credential.source.CredentialSource,Exception> getCredentialSourceSupplier(OperationContext context, ObjectTypeAttributeDefinition credentialReferenceAttributeDefinition, org.jboss.dmr.ModelNode model, org.jboss.msc.service.ServiceBuilder<?> serviceBuilder) throws OperationFailedException Get the ExceptionSupplier ofCredentialSourcewhich might throw an Exception while getting it.CredentialSourceis used later to retrieve the credential requested by configuration.- Parameters:
context- operation contextcredentialReferenceAttributeDefinition- credential-reference attribute definitionmodel- containing the actual valuesserviceBuilder- of service which needs the credential- Returns:
- ExceptionSupplier of CredentialSource
- Throws:
OperationFailedException- wrapping exception when something goes wrong
-
getCredentialSourceSupplier
public static org.wildfly.common.function.ExceptionSupplier<org.wildfly.security.credential.source.CredentialSource,Exception> getCredentialSourceSupplier(OperationContext context, ObjectTypeAttributeDefinition credentialReferenceAttributeDefinition, org.jboss.dmr.ModelNode model, org.jboss.msc.service.ServiceBuilder<?> serviceBuilder, String keySuffix) throws OperationFailedException Get the ExceptionSupplier ofCredentialSourcewhich might throw an Exception while getting it.CredentialSourceis used later to retrieve the credential requested by configuration.- Parameters:
context- operation contextcredentialReferenceAttributeDefinition- credential-reference attribute definitionmodel- containing the actual valuesserviceBuilder- of service which needs the credentialkeySuffix- extra path elements- Returns:
- ExceptionSupplier of CredentialSource
- Throws:
OperationFailedException- wrapping exception when something goes wrong
-
getCredentialSource
public static org.wildfly.security.credential.source.CredentialSource getCredentialSource(OperationContext context, ObjectTypeAttributeDefinition credentialReferenceAttributeDefinition, org.jboss.dmr.ModelNode model) throws OperationFailedException - Throws:
OperationFailedException
-
handleCredentialReferenceUpdate
public static void handleCredentialReferenceUpdate(OperationContext context, org.jboss.dmr.ModelNode model) throws OperationFailedException - Throws:
OperationFailedException
-
rollbackCredentialStoreUpdate
public static void rollbackCredentialStoreUpdate(AttributeDefinition credentialReferenceAD, OperationContext context, Resource resource) -
rollbackCredentialStoreUpdate
public static void rollbackCredentialStoreUpdate(AttributeDefinition credentialReferenceAD, OperationContext context, org.jboss.dmr.ModelNode resolvedValue) -
rollbackCredentialStoreUpdate
public static void rollbackCredentialStoreUpdate(AttributeDefinition credentialReferenceAD, OperationContext context, String store, String alias) -
handleCredentialReferenceUpdate
public static void handleCredentialReferenceUpdate(OperationContext context, org.jboss.dmr.ModelNode credentialReference, String credentialReferenceAttributeName) throws OperationFailedException - Throws:
OperationFailedException
-
applyCredentialReferenceUpdateToRuntime
public static boolean applyCredentialReferenceUpdateToRuntime(OperationContext context, org.jboss.dmr.ModelNode operation, org.jboss.dmr.ModelNode resolvedValue, org.jboss.dmr.ModelNode currentValue, String attributeName) throws OperationFailedException - Throws:
OperationFailedException
-