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