Class ResourceAttributes<R extends ResourceAttributes<R>>
Object
se.curity.identityserver.sdk.attribute.Attributes
se.curity.identityserver.sdk.attribute.scim.v2.ResourceAttributes<R>
- All Implemented Interfaces:
Iterable<Attribute>,AttributeContainer<Attributes>,SerializableAsMap
- Direct Known Subclasses:
AccountAttributes,DeviceAttributes,DynamicallyRegisteredClientAttributes
Base class for the SCIM types
A resource can be a user, device, group and such.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedResourceAttributes(Attributes attributes, String schema) Must perform no validation whatsoever! This is used to create resources that may not contain anything. -
Method Summary
Modifier and TypeMethodDescriptionAdd the given schema to the List of schemas if necessary.Appends the given attribute to a copy of this, returning the result.filter(ResourceQuery.AttributesEnumeration attributesEnumeration) Filter the attributes of this ResourceAttributes.protected abstract Rfrom(Attributes attributes) Create a new instance of R from the provided Attributes.static ResourceAttributes<?>getBooleanValue(@Nullable Attribute attribute) A String that is an identifier for the resource as defined by the provisioning client.getId()A unique identifier for a SCIM resource as defined by the service provider.getListOfUniqueStringsValue(@Nullable Attribute attribute) getMeta()An attribute containing resource metadata.The namespaces used in this resource.getStringValue(@Nullable Attribute attribute) getStringValue(@Nullable Attribute attribute, NullableFunction<String, String> validator) Gets the validated string value of an attributeprotected static voidlogFailedAttributeValidation(String path, String value, String validationError) protected static voidlogFailedAttributeValidation(String path, AttributeValue attributeValue, String expectedType) removeAttribute(String name) Remove the top-level attribute with the given name.Add the given attributes if not present, or replace the attribute if it already exists.Add the given attribute if not present, or replace the attribute if it already exists.withExternalId(String externalId) Update the resource with external id.Update the resource with id.Update the resource with meta data.withSchemas(String... schemas) Update the resource with schemas.static ResourceAttributes<?>Methods inherited from class se.curity.identityserver.sdk.attribute.Attributes
append, asMap, contains, empty, equals, fromMap, get, getAll, getMandatoryAttribute, getMandatoryValue, getValuesOfType, hashCode, isEmpty, iterator, keys, of, of, of, of, of, of, of, removeAttributes, retainAttributes, size, stream, toMap, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface se.curity.identityserver.sdk.attribute.AttributeContainer
contains, getOptionalValue, getOptionalValue, retainAttributeMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
EXTERNAL_ID
- See Also:
-
ID
- See Also:
-
META
- See Also:
-
SCHEMAS
- See Also:
-
-
Constructor Details
-
ResourceAttributes
Must perform no validation whatsoever! This is used to create resources that may not contain anything. If the mandatory attributes are missing (ID for example) the caller might be able to handle that appropriately.- Parameters:
attributes- attributesschema- schema of this resource
-
-
Method Details
-
wrap
-
fromMap
-
from
Create a new instance of R from the provided Attributes.- Parameters:
attributes- source attributes.- Returns:
- attributes wrapped into an instance of R.
-
getId
A unique identifier for a SCIM resource as defined by the service provider.This is a mandatory value.
- Returns:
- the id
-
getExternalId
A String that is an identifier for the resource as defined by the provisioning client.- Returns:
- the external ID, or null if not set
-
getMeta
An attribute containing resource metadata.- Returns:
- the meta data of the resource, or null if not set
-
getSchemas
The namespaces used in this resource.This is a mandatory value
- Returns:
- list of schemas
-
with
Description copied from interface:AttributeContainerAdd the given attribute if not present, or replace the attribute if it already exists. Note that two attributes with the same name and different authorities are considered distinct.- Specified by:
within interfaceAttributeContainer<R extends ResourceAttributes<R>>- Overrides:
within classAttributes- Parameters:
attribute- attribute to add or to override- Returns:
- a copy of this which contains the given Attribute
-
with
Description copied from interface:AttributeContainerAdd the given attributes if not present, or replace the attribute if it already exists. Note that two attributes with the same name and different authorities are considered distinct.- Specified by:
within interfaceAttributeContainer<R extends ResourceAttributes<R>>- Overrides:
within classAttributes- Parameters:
attributes- attribute to add or to override- Returns:
- a copy of this which contains the given Attributes
-
append
Description copied from interface:AttributeContainerAppends the given attribute to a copy of this, returning the result.- Specified by:
appendin interfaceAttributeContainer<R extends ResourceAttributes<R>>- Overrides:
appendin classAttributes- Parameters:
attributes- to append- Returns:
- copy of this with the provided attribute appended to it
-
withSchemas
Update the resource with schemas.- Parameters:
schemas- to add- Returns:
- copy of the resource with the added schemas
-
addSchema
Add the given schema to the List of schemas if necessary.If the given schema was already in the List, an unmodified instance is returned.
- Parameters:
schema- to add- Returns:
- copy of the resource with the added schemas, or the unmodified instance if the schema already existed
-
withMeta
Update the resource with meta data.- Parameters:
meta- to add- Returns:
- copy of the resource with the added meta
-
withId
Update the resource with id.- Parameters:
id- to add- Returns:
- copy of the resource with the added id
-
withExternalId
Update the resource with external id.- Parameters:
externalId- to add- Returns:
- copy of the resource with the added external id
-
removeAttribute
Remove the top-level attribute with the given name.- Parameters:
name- of the attributes to exclude.- Returns:
- this Attributes without the excluded top-level attribute
- Throws:
IllegalArgumentException- if a mandatory attribute is removed, because that would cause the resource to become invalid.
-
filter
Filter the attributes of this ResourceAttributes.Because the attributes enumeration may remove mandatory attributes from type
<R>, the returned instance is a more genericResourceAttributes<?>. Notice that this means the enumeration must NOT filter out attributes which are mandatory inResourceAttributes<?>.- Parameters:
attributesEnumeration- to use for filtering attributes.- Returns:
- these attributes filtered using the given predicate.
-
getBooleanValue
-
getStringValue
-
getStringValue
@Nullable protected static @Nullable String getStringValue(@Nullable Attribute attribute, NullableFunction<String, String> validator) Gets the validated string value of an attribute- Parameters:
attribute- the source attributevalidator- the validator function, which returns an optional error string- Returns:
- the validated string value of the attribute
-
getListOfUniqueStringsValue
-
logFailedAttributeValidation
protected static void logFailedAttributeValidation(String path, AttributeValue attributeValue, String expectedType) -
logFailedAttributeValidation
-