001package com.nimbusds.openid.connect.sdk.claims; 002 003 004import com.nimbusds.oauth2.sdk.ParseException; 005 006 007/** 008 * Enumeration of the claim types. 009 * 010 * <p>Related specifications: 011 * 012 * <ul> 013 * <li>OpenID Connect Core 1.0, section 5.6. 014 * <li>OpenID Connect Discovery 1.0, section 3. 015 * </ul> 016 */ 017public enum ClaimType { 018 019 /** 020 * Claims that are directly asserted by the OpenID Connect provider. 021 */ 022 NORMAL, 023 024 025 /** 026 * Claims that are asserted by a claims provider other than the 027 * OpenID Connect Provider but are returned by OpenID Connect provider. 028 */ 029 AGGREGATED, 030 031 032 /** 033 * Claims that are asserted by a claims provider other than the OpenID 034 * Connect provider but are returned as references by the OpenID 035 * Connect provider. 036 */ 037 DISTRIBUTED; 038 039 040 /** 041 * Returns the string identifier of this claim type. 042 * 043 * @return The string identifier. 044 */ 045 @Override 046 public String toString() { 047 048 return super.toString().toLowerCase(); 049 } 050 051 052 /** 053 * Parses a claim type. 054 * 055 * @param s The string to parse. Must not be {@code null}. 056 * 057 * @return The claim type. 058 */ 059 public static ClaimType parse(final String s) 060 throws ParseException { 061 062 if (s.equals("normal")) 063 return NORMAL; 064 065 if (s.equals("aggregated")) 066 return AGGREGATED; 067 068 if (s.equals("distributed")) 069 return DISTRIBUTED; 070 071 throw new ParseException("Unknow claim type: " + s); 072 } 073}