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