Class ScriptedIdPAttributeImpl
java.lang.Object
net.shibboleth.idp.attribute.resolver.ad.impl.ScriptedIdPAttributeImpl
- All Implemented Interfaces:
ScriptedIdPAttribute
- Direct Known Subclasses:
BasicAttribute
An encapsulated Attribute suitable for handing to scripts. This handles some of the cumbersome issues associated with
IdPAttribute
and also a lot of the V2 backwards compatibility stuff.
NOTE, the java signature for this class may and will change on minor version changes. However the Scripting interface will remain the same (methods will never be removed).
-
Field Summary
FieldsModifier and TypeFieldDescriptionAll theStringAttributeValue
, but as strings.private boolean
has methodgetNativeAttribute()
be called.private final IdPAttribute
TheIdPAttribute
we are encapsulating.private final org.slf4j.Logger
Logger.private final String
The prefix for logging. -
Constructor Summary
ConstructorsConstructorDescriptionScriptedIdPAttributeImpl
(IdPAttribute attribute, String prefix) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
addAsIdPAttributeValue
(List<IdPAttributeValue> values, Object value) Add the provided value to the provided list, convertingString
toStringAttributeValue
.void
Add the provided object to the attribute values, policing for type.getId()
Get the encapsulated attributeId.protected String
The prefix for the logs.return the underlying attribute.protected IdPAttribute
Function to reconstruct the attribute after the scripting.Return all the values, but withStringAttributeValue
values returned as strings.private void
policeValueType
(Object what) Check that provided object is of typeString
orIdPAttributeValue
.private void
We use an internal list of attribute values to allow the legacy use of getValues().add().
-
Field Details
-
encapsulatedAttribute
TheIdPAttribute
we are encapsulating. -
log
private final org.slf4j.Logger logLogger. -
calledGetNativeAttribute
private boolean calledGetNativeAttributehas methodgetNativeAttribute()
be called. -
attributeValues
All theStringAttributeValue
, but as strings.All other attributes as their native representation. If null then the
getValues()
method has not been called. -
logPrefix
The prefix for logging. Derived from the definition's logPrefix and the attribute ID.
-
-
Constructor Details
-
ScriptedIdPAttributeImpl
Constructor.- Parameters:
attribute
- the attribute we are encapsulating.prefix
- the log path from the definition.
-
-
Method Details
-
setupAttributeValues
private void setupAttributeValues()We use an internal list of attribute values to allow the legacy use of getValues().add(). -
getValues
Return all the values, but withStringAttributeValue
values returned as strings.This method is a helper method for V2 compatibility.
- Specified by:
getValues
in interfaceScriptedIdPAttribute
- Returns:
- a modifiable collection of the string attributes (not the String
- Throws:
ResolutionException
- if the script has calledgetNativeAttribute()
-
getNativeAttribute
return the underlying attribute.- Specified by:
getNativeAttribute
in interfaceScriptedIdPAttribute
- Returns:
- the attribute
- Throws:
ResolutionException
- if the script has called getValues.
-
getId
Get the encapsulated attributeId.- Specified by:
getId
in interfaceScriptedIdPAttribute
- Returns:
- the id
-
addAsIdPAttributeValue
Add the provided value to the provided list, convertingString
toStringAttributeValue
.- Parameters:
values
- the list to add to.value
- the value to add. Known to be aString
or anIdPAttributeValue
-
policeValueType
Check that provided object is of typeString
orIdPAttributeValue
.- Parameters:
what
- value to check- Throws:
ResolutionException
- if there is a type conflict.
-
addValue
Add the provided object to the attribute values, policing for type.- Specified by:
addValue
in interfaceScriptedIdPAttribute
- Parameters:
what
- aString
or aIdPAttributeValue
to add.- Throws:
ResolutionException
- if the provided value is of the wrong type
-
getResultingAttribute
Function to reconstruct the attribute after the scripting. IfgetValues()
has been called then this is taken as the content and the attribute updated, otherwise the Attribute is returned.- Returns:
- a suitable modified attribute.
- Throws:
ResolutionException
- if we find the wrong type.
-
getLogPrefix
The prefix for the logs.- Returns:
- the prefix
-