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 * 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 * @param requestContext Provides access to additional parameters 041 * about the request. Not {@code null}. 042 * 043 * @return The claims, {@code null} if the subject wasn't found or the 044 * claims source is {@link #isEnabled disabled}. 045 * 046 * @throws Exception If retrieval of the claims failed. 047 */ 048 UserInfo getClaims(final Subject subject, 049 final Set<String> claims, 050 final List<LangTag> claimsLocales, 051 final ClaimsSourceRequestContext requestContext) 052 throws Exception; 053}