stringOneAndOnly Function Description

Description

This function takes in a bag of attributes of type string and returns a single value. It only works if the bag contains a single value. If the bag contains zero values or more than 1 value than the function will trigger an error yielding Indeterminate. Use this function when you need to compare an attribute to a single value. See example below.

stringOneAndOnly belongs to the ALFA function reference's Bag functions category. It maps to the XACML function identifier urn:oasis:names:tc:xacml:1.0:function:string-one-and-only, takes 1 argument and returns a value of type string.

Property Value
Category Bag functions
# Arguments 1
Arguments
  • A bag of attribute values of type string.
Return Value string
Expressed As pre-fix
Representation ALFA short name
Allowed In Target false
ALFA Shorthand None
Commutative false

Example

/**
 * Compare 2 strings. Keep in mind string comparison is case-sensitive.
 */
rule stringOneAndOnlyExample{
    permit
    condition stringOneAndOnly(title)=="Fine-grained authorization policies with ALFA"
}

In this example, access is permitted if the item's title is equal to Fine-grained authorization policies with ALFA.