All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.nimbusds.openid.connect.provider.claims.source.spi.ClaimsSource Maven / Gradle / Ivy

package com.nimbusds.openid.connect.provider.claims.source.spi;


import java.util.List;
import java.util.Set;

import com.nimbusds.langtag.LangTag;

import com.nimbusds.oauth2.sdk.id.Subject;

import com.nimbusds.openid.connect.sdk.claims.UserInfo;


/**
 * Source of OpenID Connect UserInfo and other claims about a subject.
 */
public interface ClaimsSource {


	/**
	 * Initialises the OpenID Connect claims source. This method is called
	 * after the claims source SPI implementation is loaded.
	 *
	 * @param initContext The initialisation context. Can be used to
	 *                    retrieve a configuration file required to set up
	 *                    the claims source, e.g. the parameters to
	 *                    establish a database connection. Not
	 *                    {@code null}.
	 *
	 * @throws Exception If initialisation failed.
	 */
	public void init(final InitContext initContext)
		throws Exception;


	/**
	 * Checks if the OpenID Connect claims source is enabled.
	 *
	 * @return {@code true} if the claims source is enabled, else
	 *         {@code false}.
	 */
	public boolean isEnabled();


	/**
	 * Returns the names of the supported OpenID Connect claims.
	 *
	 * 

Example: * *

	 * name
	 * email
	 * email_verified
	 * 
* * @return The supported claim names. Should not include the reserved * {@code sub} (subject) claim name. */ public Set supportedClaims(); /** * Requests claims for the specified subject. * * @param subject The subject. Must not be {@code null}. * @param claims The names of the requested claims, with * optional language tags. Must not be * {@code null}. * @param claimsLocales The preferred languages and scripts for the * claims to return, {@code null} if not * specified. * * @return The claims, {@code null} if the subject wasn't found or the * claims source is {@link #isEnabled disabled}. * * @throws Exception If retrieval of the claims failed. */ public UserInfo getClaims(final Subject subject, final Set claims, final List claimsLocales) throws Exception; /** * Shuts down the OpenID Connect claims source. This method is called * on OpenID Connect Provider (OP) shutdown. * * @throws Exception If proper shutdown failed. */ public void shutdown() throws Exception; }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy