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         * Requests claims for the specified subject.
036         *
037         * @param subject        The subject. Must not be {@code null}.
038         * @param claims         The names of the requested claims, with
039         *                       optional language tags. Must not be
040         *                       {@code null}.
041         * @param claimsLocales  The preferred languages and scripts for the
042         *                       claims to return, {@code null} if not
043         *                       specified.
044         * @param requestContext Provides access to additional parameters
045         *                       about the request. Not {@code null}.
046         *
047         * @return The claims, {@code null} if the subject wasn't found or the
048         *         claims source is {@link #isEnabled disabled}.
049         *
050         * @throws Exception If retrieval of the claims failed.
051         */
052        UserInfo getClaims(final Subject subject,
053                           final Set<String> claims,
054                           final List<LangTag> claimsLocales,
055                           final ClaimsSourceRequestContext requestContext)
056                throws Exception;
057}