jakarta.security.enterprise.identitystore.openid.OpenIdClaims Maven / Gradle / Ivy
/*
* Copyright (c) 2021, 2022 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*
*/
/*
*
* Contributors:
* 2021 : Payara Foundation and/or its affiliates
* Initially authored in Security Connectors
*/
package jakarta.security.enterprise.identitystore.openid;
import static jakarta.security.enterprise.authentication.mechanism.http.openid.OpenIdConstant.*;
import java.util.Optional;
/**
* User Claims received from the userinfo endpoint.
*
* @author Gaurav Gupta
* @author Rudy De Busscher
*/
public interface OpenIdClaims extends Claims {
default String getSubject() {
return getStringClaim(SUBJECT_IDENTIFIER).orElseThrow(() -> new IllegalArgumentException("Payload does not represent correct UserInfo response"));
}
default Optional getName() {
return getStringClaim(NAME);
}
default Optional getFamilyName() {
return getStringClaim(FAMILY_NAME);
}
default Optional getGivenName() {
return getStringClaim(GIVEN_NAME);
}
default Optional getMiddleName() {
return getStringClaim(MIDDLE_NAME);
}
default Optional getNickname() {
return getStringClaim(NICKNAME);
}
default Optional getPreferredUsername() {
return getStringClaim(PREFERRED_USERNAME);
}
default Optional getProfile() {
return getStringClaim(PROFILE);
}
default Optional getPicture() {
return getStringClaim(PICTURE);
}
default Optional getGender() {
return getStringClaim(GENDER);
}
default Optional getBirthdate() {
return getStringClaim(BIRTHDATE);
}
default Optional getZoneinfo() {
return getStringClaim(ZONEINFO);
}
default Optional getLocale() {
return getStringClaim(LOCALE);
}
default Optional getUpdatedAt() {
return getStringClaim(UPDATED_AT);
}
default Optional getEmail() {
return getStringClaim(EMAIL);
}
default Optional getEmailVerified() {
return getStringClaim(EMAIL_VERIFIED);
}
default Optional getAddress() {
return getStringClaim(ADDRESS);
}
default Optional getPhoneNumber() {
return getStringClaim(PHONE_NUMBER);
}
default Optional getPhoneNumberVerified() {
return getStringClaim(PHONE_NUMBER_VERIFIED);
}
default Optional getWebsite() {
return getStringClaim(WEBSITE);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy