001package com.nimbusds.openid.connect.provider.spi.claims;
002
003
004import java.util.List;
005import java.util.Set;
006
007import net.jcip.annotations.ThreadSafe;
008
009import com.nimbusds.langtag.LangTag;
010import com.nimbusds.oauth2.sdk.id.Subject;
011import com.nimbusds.openid.connect.sdk.claims.UserInfo;
012
013
014/**
015 * Advanced Service Provider Interface (SPI) for sourcing OpenID Connect
016 * UserInfo and other claims about a subject (end-user). This interface is
017 * intended for claims sources that require access to additional parameters,
018 * such as the client identifier (client_id); if that's not needed stick to the
019 * {@link ClaimsSource basic interface}. Implementations must be thread-safe.
020 *
021 * <p>Claims sources can be:
022 *
023 * <ul>
024 *     <li>LDAP directories
025 *     <li>SQL or NoSQL databases
026 *     <li>Web services
027 *     <li>Files
028 * </ul>
029 */
030@ThreadSafe
031public interface AdvancedClaimsSource extends CommonClaimsSource {
032        
033        
034        /**
035         * The {@code verified:} prefix for names of verified claims.
036         */
037        String VERIFIED_CLAIM_NAME_PREFIX = "verified:";
038
039        
040        /**
041         * Requests claims for the specified subject.
042         *
043         * @param subject        The subject. Must not be {@code null}.
044         * @param claims         The names of the requested claims, with
045         *                       optional language tags. The names of verified
046         *                       claims (OpenID Connect for Identity Assurance
047         *                       1.0) are prefixed with "verified:". Not
048         *                       {@code null}.
049         * @param claimsLocales  The preferred languages and scripts for the
050         *                       claims to return, {@code null} if not
051         *                       specified.
052         * @param requestContext Provides access to additional parameters
053         *                       about the request. Not {@code null}.
054         *
055         * @return The claims, {@code null} if the subject wasn't found or the
056         *         claims source is {@link #isEnabled disabled}.
057         *
058         * @throws Exception If retrieval of the claims failed.
059         */
060        UserInfo getClaims(final Subject subject,
061                           final Set<String> claims,
062                           final List<LangTag> claimsLocales,
063                           final ClaimsSourceRequestContext requestContext)
064                throws Exception;
065}