CoreTokenField.java revision 1b5cb8422c825dbdc6d7669e74f285cede6ab71c
/**
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2013-2015 ForgeRock AS.
*/
/**
* CoreTokenField contains a mapping from the Java enumeration and the defined
* attributes present in the LDAP Schema for the Core Token Service.
*
* Note: These enumerations are backed by LDAP attributes and as such are the
* only attributes available to populate for any Token that is to be stored.
*
* Other enumerations may exist for the convenience of development, however
* they must link to these enumerated values.
*
* @see org.forgerock.openam.cts.api.fields.SAMLTokenField
* @see org.forgerock.openam.cts.api.fields.OAuthTokenField
*/
public enum CoreTokenField {
BLOB("coreTokenObject", byte[].class),
// Generic indexed String fields
// Generic indexed Integer fields
// Generic indexed Date fields
private final String ldapAttribute;
private final Class<?> attributeType;
/**
* @param ldapAttribute The name of the field that this CoreTokenField is associated to.
*/
this.ldapAttribute = ldapAttribute;
this.attributeType = attributeType;
}
public Class<?> getAttributeType() {
return attributeType;
}
/**
* Convert the field name into a CoreTokenField enumeration.
*
* This is the reverse of calling toString on this enum.
*
* @param value The String representation of a CoreTokenField.
* @return Non null CoreTokenField if the String provided matches a CoreTokenField.
* @throws IllegalArgumentException If the value provided did not match a CoreTokenField.
*/
return field;
}
}
}
/**
* Convert the enumeration into its LDAP attribute representation.
*
* @return The name of the LDAP Attribute.
*/
return ldapAttribute;
}
}