001/* 002 * oauth2-oidc-sdk 003 * 004 * Copyright 2012-2016, Connect2id Ltd and contributors. 005 * 006 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use 007 * this file except in compliance with the License. You may obtain a copy of the 008 * License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software distributed 013 * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 014 * CONDITIONS OF ANY KIND, either express or implied. See the License for the 015 * specific language governing permissions and limitations under the License. 016 */ 017 018package com.nimbusds.openid.connect.sdk.claims; 019 020 021import java.net.URI; 022import java.util.*; 023 024import net.minidev.json.JSONObject; 025 026import com.nimbusds.langtag.LangTag; 027import com.nimbusds.oauth2.sdk.ParseException; 028import com.nimbusds.openid.connect.sdk.assurance.claims.Birthplace; 029import com.nimbusds.openid.connect.sdk.assurance.claims.CountryCode; 030import com.nimbusds.openid.connect.sdk.assurance.claims.MSISDN; 031 032 033/** 034 * Person-specific claims set, intended to provide common getters and setters 035 * for {@link UserInfo OpenID Connect UserInfo} and 036 * {@link com.nimbusds.openid.connect.sdk.assurance.claims.VerifiedClaimsSet 037 * OpenID Connect Identity Assurance verified claims}. 038 * 039 * <p>Related specifications: 040 * 041 * <ul> 042 * <li>OpenID Connect Core 1.0, sections 5.1 and 5.6. 043 * <li>OpenID Connect for Identity Assurance 1.0, section 4.1. 044 * </ul> 045 */ 046public class PersonClaims extends ClaimsSet { 047 048 049 /** 050 * The name claim name. 051 */ 052 public static final String NAME_CLAIM_NAME = "name"; 053 054 055 /** 056 * The given name claim name. 057 */ 058 public static final String GIVEN_NAME_CLAIM_NAME = "given_name"; 059 060 061 /** 062 * The family name claim name. 063 */ 064 public static final String FAMILY_NAME_CLAIM_NAME = "family_name"; 065 066 067 /** 068 * The middle name claim name. 069 */ 070 public static final String MIDDLE_NAME_CLAIM_NAME = "middle_name"; 071 072 073 /** 074 * The nickname claim name. 075 */ 076 public static final String NICKNAME_CLAIM_NAME = "nickname"; 077 078 079 /** 080 * The preferred username claim name. 081 */ 082 public static final String PREFERRED_USERNAME_CLAIM_NAME = "preferred_username"; 083 084 085 /** 086 * The profile claim name. 087 */ 088 public static final String PROFILE_CLAIM_NAME = "profile"; 089 090 091 /** 092 * The picture claim name. 093 */ 094 public static final String PICTURE_CLAIM_NAME = "picture"; 095 096 097 /** 098 * The website claim name. 099 */ 100 public static final String WEBSITE_CLAIM_NAME = "website"; 101 102 103 /** 104 * The email claim name. 105 */ 106 public static final String EMAIL_CLAIM_NAME = "email"; 107 108 109 /** 110 * The email verified claim name. 111 */ 112 public static final String EMAIL_VERIFIED_CLAIM_NAME = "email_verified"; 113 114 115 /** 116 * The gender claim name. 117 */ 118 public static final String GENDER_CLAIM_NAME = "gender"; 119 120 121 /** 122 * The birth date claim name. 123 */ 124 public static final String BIRTHDATE_CLAIM_NAME = "birthdate"; 125 126 127 /** 128 * The zoneinfo claim name. 129 */ 130 public static final String ZONEINFO_CLAIM_NAME = "zoneinfo"; 131 132 133 /** 134 * The locale claim name. 135 */ 136 public static final String LOCALE_CLAIM_NAME = "locale"; 137 138 139 /** 140 * The phone number claim name. 141 */ 142 public static final String PHONE_NUMBER_CLAIM_NAME = "phone_number"; 143 144 145 /** 146 * The phone number verified claim name. 147 */ 148 public static final String PHONE_NUMBER_VERIFIED_CLAIM_NAME = "phone_number_verified"; 149 150 151 /** 152 * The address claim name. 153 */ 154 public static final String ADDRESS_CLAIM_NAME = "address"; 155 156 157 /** 158 * The updated at claim name. 159 */ 160 public static final String UPDATED_AT_CLAIM_NAME = "updated_at"; 161 162 163 /** 164 * The birthplace claim name (OpenID Connect for Identity Assurance 165 * 1.0). Alternative for {@link #PLACE_OF_BIRTH_CLAIM_NAME}. 166 */ 167 @Deprecated 168 public static final String BIRTHPLACE_CLAIM_NAME = "birthplace"; 169 170 171 /** 172 * The place of birth claim name (OpenID Connect for Identity Assurance 173 * 1.0). Alternative for {@link #BIRTHPLACE_CLAIM_NAME}. 174 */ 175 public static final String PLACE_OF_BIRTH_CLAIM_NAME = "place_of_birth"; 176 177 178 /** 179 * The nationalities claim name (OpenID Connect for Identity Assurance 180 * 1.0). 181 */ 182 public static final String NATIONALITIES_CLAIM_NAME = "nationalities"; 183 184 185 /** 186 * The birth family name claim name (OpenID Connect for Identity 187 * Assurance 1.0). 188 */ 189 public static final String BIRTH_FAMILY_NAME_CLAIM_NAME = "birth_family_name"; 190 191 192 /** 193 * The birth given name claim name (OpenID Connect for Identity 194 * Assurance 1.0). 195 */ 196 public static final String BIRTH_GIVEN_NAME_CLAIM_NAME = "birth_given_name"; 197 198 199 /** 200 * The birth middle name claim name (OpenID Connect for Identity 201 * Assurance 1.0). 202 */ 203 public static final String BIRTH_MIDDLE_NAME_CLAIM_NAME = "birth_middle_name"; 204 205 206 /** 207 * The salutation claim name (OpenID Connect for Identity Assurance 208 * 1.0). 209 */ 210 public static final String SALUTATION_CLAIM_NAME = "salutation"; 211 212 213 /** 214 * The title claim name (OpenID Connect for Identity Assurance 1.0). 215 */ 216 public static final String TITLE_CLAIM_NAME = "title"; 217 218 219 /** 220 * The MSISDN claim name (OpenID Connect for Identity Assurance 1.0). 221 */ 222 public static final String MSISDN_CLAIM_NAME = "msisdn"; 223 224 225 /** 226 * The also known as claim name (OpenID Connect for Identity Assurance 227 * 1.0). 228 */ 229 public static final String ALSO_KNOWN_AS = "also_known_as"; 230 231 232 /** 233 * Gets the names of the standard top-level UserInfo claims. 234 * 235 * @return The names of the standard top-level UserInfo claims 236 * (read-only set). 237 */ 238 public static Set<String> getStandardClaimNames() { 239 240 Set<String> names = new HashSet<>(ClaimsSet.getStandardClaimNames()); 241 names.addAll(Arrays.asList( 242 NAME_CLAIM_NAME, 243 GIVEN_NAME_CLAIM_NAME, 244 FAMILY_NAME_CLAIM_NAME, 245 MIDDLE_NAME_CLAIM_NAME, 246 NICKNAME_CLAIM_NAME, 247 PREFERRED_USERNAME_CLAIM_NAME, 248 PROFILE_CLAIM_NAME, 249 PICTURE_CLAIM_NAME, 250 WEBSITE_CLAIM_NAME, 251 EMAIL_CLAIM_NAME, 252 EMAIL_VERIFIED_CLAIM_NAME, 253 GENDER_CLAIM_NAME, 254 BIRTHDATE_CLAIM_NAME, 255 ZONEINFO_CLAIM_NAME, 256 LOCALE_CLAIM_NAME, 257 PHONE_NUMBER_CLAIM_NAME, 258 PHONE_NUMBER_VERIFIED_CLAIM_NAME, 259 ADDRESS_CLAIM_NAME, 260 UPDATED_AT_CLAIM_NAME, 261 BIRTHPLACE_CLAIM_NAME, 262 PLACE_OF_BIRTH_CLAIM_NAME, 263 NATIONALITIES_CLAIM_NAME, 264 BIRTH_FAMILY_NAME_CLAIM_NAME, 265 BIRTH_GIVEN_NAME_CLAIM_NAME, 266 BIRTH_MIDDLE_NAME_CLAIM_NAME, 267 SALUTATION_CLAIM_NAME, 268 TITLE_CLAIM_NAME, 269 MSISDN_CLAIM_NAME, 270 ALSO_KNOWN_AS 271 )); 272 return Collections.unmodifiableSet(names); 273 } 274 275 276 /** 277 * Creates a new empty person-specific claims set. 278 */ 279 public PersonClaims() { 280 this(new JSONObject()); 281 } 282 283 284 /** 285 * Creates a new person-specific claims set from the specified JSON 286 * object. 287 * 288 * @param jsonObject The JSON object. Must not be {@code null}. 289 */ 290 public PersonClaims(final JSONObject jsonObject) { 291 292 super(jsonObject); 293 } 294 295 296 // name 297 298 299 /** 300 * Gets the full name. Corresponds to the {@code name} claim, with no 301 * language tag. 302 * 303 * @return The full name, {@code null} if not specified. 304 */ 305 public String getName() { 306 307 return getStringClaim(NAME_CLAIM_NAME); 308 } 309 310 311 /** 312 * Gets the full name. Corresponds to the {@code name} claim, with an 313 * optional language tag. 314 * 315 * @param langTag The language tag of the entry, {@code null} to get 316 * the non-tagged entry. 317 * 318 * @return The full name, {@code null} if not specified. 319 */ 320 public String getName(final LangTag langTag) { 321 322 return getStringClaim(NAME_CLAIM_NAME, langTag); 323 } 324 325 326 /** 327 * Gets the full name entries. Correspond to the {@code name} claim. 328 * 329 * @return The full name entries, empty map if none. 330 */ 331 public Map<LangTag,String> getNameEntries() { 332 333 return getLangTaggedClaim(NAME_CLAIM_NAME, String.class); 334 } 335 336 337 /** 338 * Sets the full name. Corresponds to the {@code name} claim, with no 339 * language tag. 340 * 341 * @param name The full name. If {@code null} the claim will be 342 * removed. 343 */ 344 public void setName(final String name) { 345 346 setClaim(NAME_CLAIM_NAME, name); 347 } 348 349 350 /** 351 * Sets the full name. Corresponds to the {@code name} claim, with an 352 * optional language tag. 353 * 354 * @param name The full name. If {@code null} the claim will be 355 * removed. 356 * @param langTag The language tag, {@code null} if not specified. 357 */ 358 public void setName(final String name, final LangTag langTag) { 359 360 setClaim(NAME_CLAIM_NAME, name, langTag); 361 } 362 363 364 // given_name 365 366 367 /** 368 * Gets the given or first name. Corresponds to the {@code given_name} 369 * claim, with no language tag. 370 * 371 * @return The given or first name, {@code null} if not specified. 372 */ 373 public String getGivenName() { 374 375 return getStringClaim(GIVEN_NAME_CLAIM_NAME); 376 } 377 378 379 /** 380 * Gets the given or first name. Corresponds to the {@code given_name} 381 * claim, with an optional language tag. 382 * 383 * @param langTag The language tag of the entry, {@code null} to get 384 * the non-tagged entry. 385 * 386 * @return The given or first name, {@code null} if not specified. 387 */ 388 public String getGivenName(final LangTag langTag) { 389 390 return getStringClaim(GIVEN_NAME_CLAIM_NAME, langTag); 391 } 392 393 394 /** 395 * Gets the given or first name entries. Correspond to the 396 * {@code given_name} claim. 397 * 398 * @return The given or first name entries, empty map if none. 399 */ 400 public Map<LangTag,String> getGivenNameEntries() { 401 402 return getLangTaggedClaim(GIVEN_NAME_CLAIM_NAME, String.class); 403 } 404 405 406 /** 407 * Sets the given or first name. Corresponds to the {@code given_name} 408 * claim, with no language tag. 409 * 410 * @param givenName The given or first name. If {@code null} the claim 411 * will be removed. 412 */ 413 public void setGivenName(final String givenName) { 414 415 setClaim(GIVEN_NAME_CLAIM_NAME, givenName); 416 } 417 418 419 /** 420 * Sets the given or first name. Corresponds to the {@code given_name} 421 * claim, with an optional language tag. 422 * 423 * @param givenName The given or first full name. If {@code null} the 424 * claim will be removed. 425 * @param langTag The language tag, {@code null} if not specified. 426 */ 427 public void setGivenName(final String givenName, final LangTag langTag) { 428 429 setClaim(GIVEN_NAME_CLAIM_NAME, givenName, langTag); 430 } 431 432 433 // family_name 434 435 436 /** 437 * Gets the surname or last name. Corresponds to the 438 * {@code family_name} claim, with no language tag. 439 * 440 * @return The surname or last name, {@code null} if not specified. 441 */ 442 public String getFamilyName() { 443 444 return getStringClaim(FAMILY_NAME_CLAIM_NAME); 445 } 446 447 448 /** 449 * Gets the surname or last name. Corresponds to the 450 * {@code family_name} claim, with an optional language tag. 451 * 452 * @param langTag The language tag of the entry, {@code null} to get 453 * the non-tagged entry. 454 * 455 * @return The surname or last name, {@code null} if not specified. 456 */ 457 public String getFamilyName(final LangTag langTag) { 458 459 return getStringClaim(FAMILY_NAME_CLAIM_NAME, langTag); 460 } 461 462 463 /** 464 * Gets the surname or last name entries. Correspond to the 465 * {@code family_name} claim. 466 * 467 * @return The surname or last name entries, empty map if none. 468 */ 469 public Map<LangTag,String> getFamilyNameEntries() { 470 471 return getLangTaggedClaim(FAMILY_NAME_CLAIM_NAME, String.class); 472 } 473 474 475 /** 476 * Sets the surname or last name. Corresponds to the 477 * {@code family_name} claim, with no language tag. 478 * 479 * @param familyName The surname or last name. If {@code null} the 480 * claim will be removed. 481 */ 482 public void setFamilyName(final String familyName) { 483 484 setClaim(FAMILY_NAME_CLAIM_NAME, familyName); 485 } 486 487 488 /** 489 * Sets the surname or last name. Corresponds to the 490 * {@code family_name} claim, with an optional language tag. 491 * 492 * @param familyName The surname or last name. If {@code null} the 493 * claim will be removed. 494 * @param langTag The language tag, {@code null} if not specified. 495 */ 496 public void setFamilyName(final String familyName, final LangTag langTag) { 497 498 setClaim(FAMILY_NAME_CLAIM_NAME, familyName, langTag); 499 } 500 501 502 // middle_name 503 504 505 /** 506 * Gets the middle name. Corresponds to the {@code middle_name} claim, 507 * with no language tag. 508 * 509 * @return The middle name, {@code null} if not specified. 510 */ 511 public String getMiddleName() { 512 513 return getStringClaim(MIDDLE_NAME_CLAIM_NAME); 514 } 515 516 517 /** 518 * Gets the middle name. Corresponds to the {@code middle_name} claim, 519 * with an optional language tag. 520 * 521 * @param langTag The language tag of the entry, {@code null} to get 522 * the non-tagged entry. 523 * 524 * @return The middle name, {@code null} if not specified. 525 */ 526 public String getMiddleName(final LangTag langTag) { 527 528 return getStringClaim(MIDDLE_NAME_CLAIM_NAME, langTag); 529 } 530 531 532 /** 533 * Gets the middle name entries. Correspond to the {@code middle_name} 534 * claim. 535 * 536 * @return The middle name entries, empty map if none. 537 */ 538 public Map<LangTag,String> getMiddleNameEntries() { 539 540 return getLangTaggedClaim(MIDDLE_NAME_CLAIM_NAME, String.class); 541 } 542 543 544 /** 545 * Sets the middle name. Corresponds to the {@code middle_name} claim, 546 * with no language tag. 547 * 548 * @param middleName The middle name. If {@code null} the claim will be 549 * removed. 550 */ 551 public void setMiddleName(final String middleName) { 552 553 setClaim(MIDDLE_NAME_CLAIM_NAME, middleName); 554 } 555 556 557 /** 558 * Sets the middle name. Corresponds to the {@code middle_name} claim, 559 * with an optional language tag. 560 * 561 * @param middleName The middle name. If {@code null} the claim will be 562 * removed. 563 * @param langTag The language tag, {@code null} if not specified. 564 */ 565 public void setMiddleName(final String middleName, final LangTag langTag) { 566 567 setClaim(MIDDLE_NAME_CLAIM_NAME, middleName, langTag); 568 } 569 570 571 // nickname 572 573 574 /** 575 * Gets the casual name. Corresponds to the {@code nickname} claim, 576 * with no language tag. 577 * 578 * @return The casual name, {@code null} if not specified. 579 */ 580 public String getNickname() { 581 582 return getStringClaim(NICKNAME_CLAIM_NAME); 583 } 584 585 586 /** 587 * Gets the casual name. Corresponds to the {@code nickname} claim, 588 * with an optional language tag. 589 * 590 * @param langTag The language tag of the entry, {@code null} to get 591 * the non-tagged entry. 592 * 593 * @return The casual name, {@code null} if not specified. 594 */ 595 public String getNickname(final LangTag langTag) { 596 597 return getStringClaim(NICKNAME_CLAIM_NAME, langTag); 598 } 599 600 601 /** 602 * Gets the casual name entries. Correspond to the {@code nickname} 603 * claim. 604 * 605 * @return The casual name entries, empty map if none. 606 */ 607 public Map<LangTag,String> getNicknameEntries() { 608 609 return getLangTaggedClaim(NICKNAME_CLAIM_NAME, String.class); 610 } 611 612 613 /** 614 * Sets the casual name. Corresponds to the {@code nickname} claim, 615 * with no language tag. 616 * 617 * @param nickname The casual name. If {@code null} the claim will be 618 * removed. 619 */ 620 public void setNickname(final String nickname) { 621 622 setClaim(NICKNAME_CLAIM_NAME, nickname); 623 } 624 625 626 /** 627 * Sets the casual name. Corresponds to the {@code nickname} claim, 628 * with an optional language tag. 629 * 630 * @param nickname The casual name. If {@code null} the claim will be 631 * removed. 632 * @param langTag The language tag, {@code null} if not specified. 633 */ 634 public void setNickname(final String nickname, final LangTag langTag) { 635 636 setClaim(NICKNAME_CLAIM_NAME, nickname, langTag); 637 } 638 639 640 // preferred_username 641 642 643 /** 644 * Gets the preferred username. Corresponds to the 645 * {@code preferred_username} claim. 646 * 647 * @return The preferred username, {@code null} if not specified. 648 */ 649 public String getPreferredUsername() { 650 651 return getStringClaim(PREFERRED_USERNAME_CLAIM_NAME); 652 } 653 654 655 /** 656 * Sets the preferred username. Corresponds to the 657 * {@code preferred_username} claim. 658 * 659 * @param preferredUsername The preferred username. If {@code null} the 660 * claim will be removed. 661 */ 662 public void setPreferredUsername(final String preferredUsername) { 663 664 setClaim(PREFERRED_USERNAME_CLAIM_NAME, preferredUsername); 665 } 666 667 668 // profile 669 670 671 /** 672 * Gets the profile page. Corresponds to the {@code profile} claim. 673 * 674 * @return The profile page URI, {@code null} if not specified. 675 */ 676 public URI getProfile() { 677 678 return getURIClaim(PROFILE_CLAIM_NAME); 679 } 680 681 682 /** 683 * Sets the profile page. Corresponds to the {@code profile} claim. 684 * 685 * @param profile The profile page URI. If {@code null} the claim will 686 * be removed. 687 */ 688 public void setProfile(final URI profile) { 689 690 setURIClaim(PROFILE_CLAIM_NAME, profile); 691 } 692 693 694 // picture 695 696 697 /** 698 * Gets the picture. Corresponds to the {@code picture} claim. 699 * 700 * @return The picture URI, {@code null} if not specified. 701 */ 702 public URI getPicture() { 703 704 return getURIClaim(PICTURE_CLAIM_NAME); 705 } 706 707 708 /** 709 * Sets the picture. Corresponds to the {@code picture} claim. 710 * 711 * @param picture The picture URI. If {@code null} the claim will be 712 * removed. 713 */ 714 public void setPicture(final URI picture) { 715 716 setURIClaim(PICTURE_CLAIM_NAME, picture); 717 } 718 719 720 // website 721 722 723 /** 724 * Gets the web page or blog. Corresponds to the {@code website} claim. 725 * 726 * @return The web page or blog URI, {@code null} if not specified. 727 */ 728 public URI getWebsite() { 729 730 return getURIClaim(WEBSITE_CLAIM_NAME); 731 } 732 733 734 /** 735 * Sets the web page or blog. Corresponds to the {@code website} claim. 736 * 737 * @param website The web page or blog URI. If {@code null} the claim 738 * will be removed. 739 */ 740 public void setWebsite(final URI website) { 741 742 setURIClaim(WEBSITE_CLAIM_NAME, website); 743 } 744 745 746 // email 747 748 749 /** 750 * Gets the preferred email address. Corresponds to the {@code email} 751 * claim. 752 * 753 * @return The preferred email address, {@code null} if not specified. 754 */ 755 public String getEmailAddress() { 756 757 return getStringClaim(EMAIL_CLAIM_NAME); 758 } 759 760 761 /** 762 * Sets the preferred email address. Corresponds to the {@code email} 763 * claim. 764 * 765 * @param email The preferred email address. If {@code null} the claim 766 * will be removed. 767 */ 768 public void setEmailAddress(final String email) { 769 770 setClaim(EMAIL_CLAIM_NAME, email); 771 } 772 773 774 // email_verified 775 776 777 /** 778 * Gets the email verification status. Corresponds to the 779 * {@code email_verified} claim. 780 * 781 * @return The email verification status, {@code null} if not 782 * specified. 783 */ 784 public Boolean getEmailVerified() { 785 786 return getBooleanClaim(EMAIL_VERIFIED_CLAIM_NAME); 787 } 788 789 790 /** 791 * Sets the email verification status. Corresponds to the 792 * {@code email_verified} claim. 793 * 794 * @param emailVerified The email verification status. If {@code null} 795 * the claim will be removed. 796 */ 797 public void setEmailVerified(final Boolean emailVerified) { 798 799 setClaim(EMAIL_VERIFIED_CLAIM_NAME, emailVerified); 800 } 801 802 803 // gender 804 805 806 /** 807 * Gets the gender. Corresponds to the {@code gender} claim. 808 * 809 * @return The gender, {@code null} if not specified. 810 */ 811 public Gender getGender() { 812 813 String value = getStringClaim(GENDER_CLAIM_NAME); 814 815 if (value == null) 816 return null; 817 818 return new Gender(value); 819 } 820 821 822 /** 823 * Sets the gender. Corresponds to the {@code gender} claim. 824 * 825 * @param gender The gender. If {@code null} the claim will be removed. 826 */ 827 public void setGender(final Gender gender) { 828 829 if (gender != null) 830 setClaim(GENDER_CLAIM_NAME, gender.getValue()); 831 else 832 setClaim(GENDER_CLAIM_NAME, null); 833 } 834 835 836 // birthdate 837 838 839 /** 840 * Gets the date of birth. Corresponds to the {@code birthdate} claim. 841 * 842 * @return The date of birth, {@code null} if not specified. 843 */ 844 public String getBirthdate() { 845 846 return getStringClaim(BIRTHDATE_CLAIM_NAME); 847 } 848 849 850 /** 851 * Sets the date of birth. Corresponds to the {@code birthdate} claim. 852 * 853 * @param birthdate The date of birth. If {@code null} the claim will 854 * be removed. 855 */ 856 public void setBirthdate(final String birthdate) { 857 858 setClaim(BIRTHDATE_CLAIM_NAME, birthdate); 859 } 860 861 862 // zoneinfo 863 864 865 /** 866 * Gets the zoneinfo. Corresponds to the {@code zoneinfo} claim. 867 * 868 * @return The zoneinfo, {@code null} if not specified. 869 */ 870 public String getZoneinfo() { 871 872 return getStringClaim(ZONEINFO_CLAIM_NAME); 873 } 874 875 876 /** 877 * Sets the zoneinfo. Corresponds to the {@code zoneinfo} claim. 878 * 879 * @param zoneinfo The zoneinfo. If {@code null} the claim will be 880 * removed. 881 */ 882 public void setZoneinfo(final String zoneinfo) { 883 884 setClaim(ZONEINFO_CLAIM_NAME, zoneinfo); 885 } 886 887 888 // locale 889 890 891 /** 892 * Gets the locale. Corresponds to the {@code locale} claim. 893 * 894 * @return The locale, {@code null} if not specified. 895 */ 896 public String getLocale() { 897 898 return getStringClaim(LOCALE_CLAIM_NAME); 899 } 900 901 902 /** 903 * Sets the locale. Corresponds to the {@code locale} claim. 904 * 905 * @param locale The locale. If {@code null} the claim will be 906 * removed. 907 */ 908 public void setLocale(final String locale) { 909 910 setClaim(LOCALE_CLAIM_NAME, locale); 911 } 912 913 914 // phone_number 915 916 917 /** 918 * Gets the preferred telephone number. Corresponds to the 919 * {@code phone_number} claim. 920 * 921 * @return The preferred telephone number, {@code null} if not 922 * specified. 923 */ 924 public String getPhoneNumber() { 925 926 return getStringClaim(PHONE_NUMBER_CLAIM_NAME); 927 } 928 929 930 /** 931 * Sets the preferred telephone number. Corresponds to the 932 * {@code phone_number} claim. 933 * 934 * @param phoneNumber The preferred telephone number. If {@code null} 935 * the claim will be removed. 936 */ 937 public void setPhoneNumber(final String phoneNumber) { 938 939 setClaim(PHONE_NUMBER_CLAIM_NAME, phoneNumber); 940 } 941 942 943 // phone_number_verified 944 945 946 /** 947 * Gets the phone number verification status. Corresponds to the 948 * {@code phone_number_verified} claim. 949 * 950 * @return The phone number verification status, {@code null} if not 951 * specified. 952 */ 953 public Boolean getPhoneNumberVerified() { 954 955 return getBooleanClaim(PHONE_NUMBER_VERIFIED_CLAIM_NAME); 956 } 957 958 959 /** 960 * Sets the email verification status. Corresponds to the 961 * {@code phone_number_verified} claim. 962 * 963 * @param phoneNumberVerified The phone number verification status. If 964 * {@code null} the claim will be removed. 965 */ 966 public void setPhoneNumberVerified(final Boolean phoneNumberVerified) { 967 968 setClaim(PHONE_NUMBER_VERIFIED_CLAIM_NAME, phoneNumberVerified); 969 } 970 971 972 // address 973 974 975 /** 976 * Gets the preferred address. Corresponds to the {@code address} 977 * claim, with no language tag. 978 * 979 * @return The preferred address, {@code null} if not specified. 980 */ 981 public Address getAddress() { 982 983 return getAddress(null); 984 } 985 986 987 /** 988 * Gets the preferred address. Corresponds to the {@code address} 989 * claim, with an optional language tag. 990 * 991 * @param langTag The language tag of the entry, {@code null} to get 992 * the non-tagged entry. 993 * 994 * @return The preferred address, {@code null} if not specified. 995 */ 996 public Address getAddress(final LangTag langTag) { 997 998 String name; 999 1000 if (langTag!= null) 1001 name = ADDRESS_CLAIM_NAME + "#" + langTag; 1002 else 1003 name = ADDRESS_CLAIM_NAME; 1004 1005 JSONObject jsonObject = getClaim(name, JSONObject.class); 1006 1007 if (jsonObject == null) 1008 return null; 1009 1010 return new Address(jsonObject); 1011 } 1012 1013 1014 /** 1015 * Gets the preferred address entries. Correspond to the 1016 * {@code address} claim. 1017 * 1018 * @return The preferred address entries, empty map if none. 1019 */ 1020 public Map<LangTag,Address> getAddressEntries() { 1021 1022 Map<LangTag,JSONObject> entriesIn = getLangTaggedClaim(ADDRESS_CLAIM_NAME, JSONObject.class); 1023 1024 Map<LangTag,Address> entriesOut = new HashMap<>(); 1025 1026 for (Map.Entry<LangTag,JSONObject> en: entriesIn.entrySet()) 1027 entriesOut.put(en.getKey(), new Address(en.getValue())); 1028 1029 return entriesOut; 1030 } 1031 1032 1033 /** 1034 * Sets the preferred address. Corresponds to the {@code address} 1035 * claim, with no language tag. 1036 * 1037 * @param address The preferred address. If {@code null} the claim will 1038 * be removed. 1039 */ 1040 public void setAddress(final Address address) { 1041 1042 if (address != null) 1043 setClaim(ADDRESS_CLAIM_NAME, address.toJSONObject()); 1044 else 1045 setClaim(ADDRESS_CLAIM_NAME, null); 1046 } 1047 1048 1049 /** 1050 * Sets the preferred address. Corresponds to the {@code address} 1051 * claim, with an optional language tag. 1052 * 1053 * @param address The preferred address. If {@code null} the claim 1054 * will be removed. 1055 * @param langTag The language tag, {@code null} if not specified. 1056 */ 1057 public void setAddress(final Address address, final LangTag langTag) { 1058 1059 String key = langTag == null ? ADDRESS_CLAIM_NAME : ADDRESS_CLAIM_NAME + "#" + langTag; 1060 1061 if (address != null) 1062 setClaim(key, address.toJSONObject()); 1063 else 1064 setClaim(key, null); 1065 } 1066 1067 1068 // updated_at 1069 1070 1071 /** 1072 * Gets the time the end-user information was last updated. Corresponds 1073 * to the {@code updated_at} claim. 1074 * 1075 * @return The time the end-user information was last updated, 1076 * {@code null} if not specified. 1077 */ 1078 public Date getUpdatedTime() { 1079 1080 return getDateClaim(UPDATED_AT_CLAIM_NAME); 1081 } 1082 1083 1084 /** 1085 * Sets the time the end-user information was last updated. Corresponds 1086 * to the {@code updated_at} claim. 1087 * 1088 * @param updatedTime The time the end-user information was last 1089 * updated. If {@code null} the claim will be 1090 * removed. 1091 */ 1092 public void setUpdatedTime(final Date updatedTime) { 1093 1094 setDateClaim(UPDATED_AT_CLAIM_NAME, updatedTime); 1095 } 1096 1097 1098 // birthplace 1099 1100 1101 /** 1102 * Gets the birthplace. Corresponds to the {@code birthplace} claim. 1103 * 1104 * @see #getPlaceOfBirth() 1105 * 1106 * @return The birthplace, {@code null} if not specified. 1107 */ 1108 @Deprecated 1109 public Birthplace getBirthplace() { 1110 1111 JSONObject jsonObject = getClaim(BIRTHPLACE_CLAIM_NAME, JSONObject.class); 1112 1113 if (jsonObject == null) { 1114 return null; 1115 } 1116 1117 return new Birthplace(jsonObject); 1118 } 1119 1120 1121 /** 1122 * Sets the birthplace. Corresponds to the {@code birthplace} claim. 1123 * 1124 * @see #setPlaceOfBirth(Birthplace) 1125 * 1126 * @param birthplace The birthplace, {@code null} if not specified. 1127 */ 1128 @Deprecated 1129 public void setBirthplace(final Birthplace birthplace) { 1130 1131 if (birthplace != null) { 1132 setClaim(BIRTHPLACE_CLAIM_NAME, birthplace.toJSONObject()); 1133 } 1134 } 1135 1136 1137 // place_of_birth 1138 1139 1140 /** 1141 * Gets the birthplace. Corresponds to the {@code place_of_birth} claim 1142 * from OpenID Connect for Identity Assurance 1.0. 1143 * 1144 * @return The birthplace, {@code null} if not specified. 1145 */ 1146 public Birthplace getPlaceOfBirth() { 1147 1148 JSONObject jsonObject = getClaim(PLACE_OF_BIRTH_CLAIM_NAME, JSONObject.class); 1149 1150 if (jsonObject == null) { 1151 return null; 1152 } 1153 1154 return new Birthplace(jsonObject); 1155 } 1156 1157 1158 /** 1159 * Sets the birthplace. Corresponds to the {@code place_of_birth} claim 1160 * from OpenID Connect for Identity Assurance 1.0. 1161 * 1162 * @param birthplace The birthplace, {@code null} if not specified. 1163 */ 1164 public void setPlaceOfBirth(final Birthplace birthplace) { 1165 1166 if (birthplace != null) { 1167 setClaim(PLACE_OF_BIRTH_CLAIM_NAME, birthplace.toJSONObject()); 1168 } 1169 } 1170 1171 1172 // nationalities 1173 1174 /** 1175 * Gets the user's nationalities. Corresponds to the 1176 * {@code nationalities} claim from OpenID Connect for Identity 1177 * Assurance 1.0. 1178 * 1179 * @return The nationalities, {@code null} if not specified or parsing 1180 * failed. 1181 */ 1182 public List<CountryCode> getNationalities() { 1183 1184 List<String> values = getStringListClaim(NATIONALITIES_CLAIM_NAME); 1185 1186 if (values == null) { 1187 return null; 1188 } 1189 1190 List<CountryCode> codes = new LinkedList<>(); 1191 for (String v: values) { 1192 if (v != null) { 1193 try { 1194 codes.add(CountryCode.parse(v)); 1195 } catch (ParseException e) { 1196 return null; 1197 } 1198 } 1199 } 1200 return codes; 1201 } 1202 1203 1204 /** 1205 * Sets the user's nationalities. Corresponds to the 1206 * {@code nationalities} claim from OpenID Connect for Identity 1207 * Assurance 1.0. 1208 * 1209 * @param nationalities The nationalities, {@code null} if not 1210 * specified. 1211 */ 1212 public void setNationalities(final List<CountryCode> nationalities) { 1213 1214 List<String> values = null; 1215 1216 if (nationalities != null) { 1217 values = new LinkedList<>(); 1218 for (CountryCode code: nationalities) { 1219 if (code != null) { 1220 values.add(code.getValue()); 1221 } 1222 } 1223 } 1224 1225 setClaim(NATIONALITIES_CLAIM_NAME, values); 1226 } 1227 1228 1229 // birth_family_name 1230 1231 /** 1232 * Gets the birth family name. Corresponds to the 1233 * {@code birth_family_name} claim from OpenID Connect for Identity 1234 * Assurance 1.0, with no language tag. 1235 * 1236 * @return The birth family name, {@code null} if not specified. 1237 */ 1238 public String getBirthFamilyName() { 1239 1240 return getStringClaim(BIRTH_FAMILY_NAME_CLAIM_NAME); 1241 } 1242 1243 1244 /** 1245 * Gets the birth family name. Corresponds to the 1246 * {@code birth_family_name} claim from OpenID Connect for Identity 1247 * Assurance 1.0, with an optional language tag. 1248 * 1249 * @param langTag The language tag of the entry, {@code null} to get 1250 * the non-tagged entry. 1251 * 1252 * @return The birth family name, {@code null} if not specified. 1253 */ 1254 public String getBirthFamilyName(final LangTag langTag) { 1255 1256 return getStringClaim(BIRTH_FAMILY_NAME_CLAIM_NAME, langTag); 1257 } 1258 1259 1260 /** 1261 * Gets the birth family name entries. Correspond to the 1262 * {@code birth_family_name} claim from OpenID Connect for Identity 1263 * Assurance 1.0. 1264 * 1265 * @return The birth family name entries, empty map if none. 1266 */ 1267 public Map<LangTag,String> getBirthFamilyNameEntries() { 1268 1269 return getLangTaggedClaim(BIRTH_FAMILY_NAME_CLAIM_NAME, String.class); 1270 } 1271 1272 1273 /** 1274 * Sets the birth family name. Corresponds to the 1275 * {@code birth_family_name} claim from OpenID Connect for Identity 1276 * Assurance 1.0, with no language tag. 1277 * 1278 * @param birthFamilyName The birth family name, {@code null} if not 1279 * specified. 1280 */ 1281 public void setBirthFamilyName(final String birthFamilyName) { 1282 1283 setClaim(BIRTH_FAMILY_NAME_CLAIM_NAME, birthFamilyName); 1284 } 1285 1286 1287 /** 1288 * Sets the birth family name. Corresponds to the 1289 * {@code birth_family_name} claim from OpenID Connect for Identity 1290 * Assurance 1.0, with an optional language tag. 1291 * 1292 * @param birthFamilyName The birth family name. If {@code null} the 1293 * claim will be removed. 1294 * @param langTag The language tag, {@code null} if not 1295 * specified. 1296 */ 1297 public void setBirthFamilyName(final String birthFamilyName, final LangTag langTag) { 1298 1299 setClaim(BIRTH_FAMILY_NAME_CLAIM_NAME, birthFamilyName, langTag); 1300 } 1301 1302 // birth_given_name 1303 1304 /** 1305 * Gets the birth given name. Corresponds to the 1306 * {@code birth_given_name} claim from OpenID Connect for Identity 1307 * Assurance 1.0, with no language tag. 1308 * 1309 * @return The birth given name, {@code null} if not specified. 1310 */ 1311 public String getBirthGivenName() { 1312 1313 return getStringClaim(BIRTH_GIVEN_NAME_CLAIM_NAME); 1314 } 1315 1316 1317 /** 1318 * Gets the birth given name. Corresponds to the 1319 * {@code birth_given_name} claim from OpenID Connect for Identity 1320 * Assurance 1.0, with an optional language tag. 1321 * 1322 * @param langTag The language tag of the entry, {@code null} to get 1323 * the non-tagged entry. 1324 * 1325 * @return The birth given name, {@code null} if not specified. 1326 */ 1327 public String getBirthGivenName(final LangTag langTag) { 1328 1329 return getStringClaim(BIRTH_GIVEN_NAME_CLAIM_NAME, langTag); 1330 } 1331 1332 1333 /** 1334 * Gets the birth given name entries. Correspond to the 1335 * {@code birth_given_name} claim from OpenID Connect for Identity 1336 * Assurance 1.0. 1337 * 1338 * @return The birth given name entries, empty map if none. 1339 */ 1340 public Map<LangTag,String> getBirthGivenNameEntries() { 1341 1342 return getLangTaggedClaim(BIRTH_GIVEN_NAME_CLAIM_NAME, String.class); 1343 } 1344 1345 1346 /** 1347 * Sets the birth given name. Corresponds to the 1348 * {@code birth_given_name} claim from OpenID Connect for Identity 1349 * Assurance 1.0. 1350 * 1351 * @param birthGivenName The birth given name, {@code null} if not 1352 * specified. 1353 */ 1354 public void setBirthGivenName(final String birthGivenName) { 1355 1356 setClaim(BIRTH_GIVEN_NAME_CLAIM_NAME, birthGivenName); 1357 } 1358 1359 1360 /** 1361 * Sets the birth given name. Corresponds to the 1362 * {@code birth_given_name} claim from OpenID Connect for Identity 1363 * Assurance 1.0, with an optional language tag. 1364 * 1365 * @param birthGivenName The birth given name. If {@code null} the 1366 * claim will be removed. 1367 * @param langTag The language tag, {@code null} if not 1368 * specified. 1369 */ 1370 public void setBirthGivenName(final String birthGivenName, final LangTag langTag) { 1371 1372 setClaim(BIRTH_GIVEN_NAME_CLAIM_NAME, birthGivenName, langTag); 1373 } 1374 1375 1376 // birth_middle_name 1377 1378 1379 /** 1380 * Gets the birth middle name. Corresponds to the 1381 * {@code birth_middle_name} claim from OpenID Connect for Identity 1382 * Assurance 1.0, with no language tag. 1383 * 1384 * @return The birth middle name, {@code null} if not specified. 1385 */ 1386 public String getBirthMiddleName() { 1387 1388 return getStringClaim(BIRTH_MIDDLE_NAME_CLAIM_NAME); 1389 } 1390 1391 1392 /** 1393 * Gets the birth middle name. Corresponds to the 1394 * {@code birth_middle_name} claim from OpenID Connect for Identity 1395 * Assurance 1.0, with an optional language tag. 1396 * 1397 * @param langTag The language tag of the entry, {@code null} to get 1398 * the non-tagged entry. 1399 * 1400 * @return The birth middle name, {@code null} if not specified. 1401 */ 1402 public String getBirthMiddleName(final LangTag langTag) { 1403 1404 return getStringClaim(BIRTH_MIDDLE_NAME_CLAIM_NAME, langTag); 1405 } 1406 1407 1408 /** 1409 * Gets the birth middle name entries. Correspond to the 1410 * {@code birth_middle_name} claim from OpenID Connect for Identity 1411 * Assurance 1.0. 1412 * 1413 * @return The birth middle name entries, empty map if none. 1414 */ 1415 public Map<LangTag,String> getBirthMiddleNameEntries() { 1416 1417 return getLangTaggedClaim(BIRTH_MIDDLE_NAME_CLAIM_NAME, String.class); 1418 } 1419 1420 1421 /** 1422 * Sets the birth middle name. Corresponds to the 1423 * {@code birth_middle_name} claim from OpenID Connect for Identity 1424 * Assurance 1.0. 1425 * 1426 * @param birthMiddleName The birth middle name, {@code null} if not 1427 * specified. 1428 */ 1429 public void setBirthMiddleName(final String birthMiddleName) { 1430 1431 setClaim(BIRTH_MIDDLE_NAME_CLAIM_NAME, birthMiddleName); 1432 } 1433 1434 1435 /** 1436 * Sets the birth middle name. Corresponds to the 1437 * {@code birth_middle_name} claim from OpenID Connect for Identity 1438 * Assurance 1.0, with an optional language tag. 1439 * 1440 * @param birthMiddleName The birth middle name. If {@code null} the 1441 * claim will be removed. 1442 * @param langTag The language tag, {@code null} if not 1443 * specified. 1444 */ 1445 public void setBirthMiddleName(final String birthMiddleName, final LangTag langTag) { 1446 1447 setClaim(BIRTH_MIDDLE_NAME_CLAIM_NAME, birthMiddleName, langTag); 1448 } 1449 1450 1451 // salutation 1452 1453 1454 /** 1455 * Gets the salutation. Corresponds to the {@code salutation} claim 1456 * from OpenID Connect for Identity Assurance 1.0, with no language 1457 * tag. 1458 * 1459 * @return The salutation, {@code null} if not specified. 1460 */ 1461 public String getSalutation() { 1462 1463 return getStringClaim(SALUTATION_CLAIM_NAME); 1464 } 1465 1466 1467 /** 1468 * Gets the salutation. Corresponds to the {@code salutation} claim 1469 * from OpenID Connect for Identity Assurance 1.0, with an optional 1470 * language tag. 1471 * 1472 * @param langTag The language tag of the entry, {@code null} to get 1473 * the non-tagged entry. 1474 * 1475 * @return The salutation, {@code null} if not specified. 1476 */ 1477 public String getSalutation(final LangTag langTag) { 1478 1479 return getStringClaim(SALUTATION_CLAIM_NAME, langTag); 1480 } 1481 1482 1483 /** 1484 * Gets the salutation entries. Correspond to the {@code salutation} 1485 * claim from OpenID Connect for Identity Assurance 1.0. 1486 * 1487 * @return The salutation entries, empty map if none. 1488 */ 1489 public Map<LangTag,String> getSalutationEntries() { 1490 1491 return getLangTaggedClaim(SALUTATION_CLAIM_NAME, String.class); 1492 } 1493 1494 1495 /** 1496 * Sets the salutation. Corresponds to the {@code salutation} claim 1497 * from OpenID Connect for Identity Assurance 1.0. 1498 * 1499 * @param salutation The salutation, {@code null} if not specified. 1500 */ 1501 public void setSalutation(final String salutation) { 1502 1503 setClaim(SALUTATION_CLAIM_NAME, salutation); 1504 } 1505 1506 1507 /** 1508 * Sets the salutation. Corresponds to the {@code salutation} claim 1509 * from OpenID Connect for Identity Assurance 1.0, with an optional 1510 * language tag. 1511 * 1512 * @param salutation The salutation. If {@code null} the claim will be 1513 * removed. 1514 * @param langTag The language tag, {@code null} if not specified. 1515 */ 1516 public void setSalutation(final String salutation, final LangTag langTag) { 1517 1518 setClaim(SALUTATION_CLAIM_NAME, salutation, langTag); 1519 } 1520 1521 1522 // title 1523 1524 1525 /** 1526 * Gets the title. Corresponds to the {@code title} claim from OpenID 1527 * Connect for Identity Assurance 1.0, with no language tag. 1528 * 1529 * @return The salutation, {@code null} if not specified. 1530 */ 1531 public String getTitle() { 1532 1533 return getStringClaim(TITLE_CLAIM_NAME); 1534 } 1535 1536 1537 /** 1538 * Gets the title. Corresponds to the {@code title} claim from OpenID 1539 * Connect for Identity Assurance 1.0, with an optional language tag. 1540 * 1541 * @param langTag The language tag of the entry, {@code null} to get 1542 * the non-tagged entry. 1543 * 1544 * @return The title, {@code null} if not specified. 1545 */ 1546 public String getTitle(final LangTag langTag) { 1547 1548 return getStringClaim(TITLE_CLAIM_NAME, langTag); 1549 } 1550 1551 1552 /** 1553 * Gets the title entries. Correspond to the {@code title} claim from 1554 * OpenID Connect for Identity Assurance 1.0. 1555 * 1556 * @return The title entries, empty map if none. 1557 */ 1558 public Map<LangTag,String> getTitleEntries() { 1559 1560 return getLangTaggedClaim(TITLE_CLAIM_NAME, String.class); 1561 } 1562 1563 1564 /** 1565 * Sets the title. Corresponds to the {@code title} claim from OpenID 1566 * Connect for Identity Assurance 1.0. 1567 * 1568 * @param title The title, {@code null} if not specified. 1569 */ 1570 public void setTitle(final String title) { 1571 1572 setClaim(TITLE_CLAIM_NAME, title); 1573 } 1574 1575 1576 /** 1577 * Sets the title. Corresponds to the {@code title} claim from OpenID 1578 * Connect for Identity Assurance 1.0, with an optional language tag. 1579 * 1580 * @param title The title. If {@code null} the claim will be removed. 1581 * @param langTag The language tag, {@code null} if not specified. 1582 */ 1583 public void setTitle(final String title, final LangTag langTag) { 1584 1585 setClaim(TITLE_CLAIM_NAME, title, langTag); 1586 } 1587 1588 1589 // msisdn 1590 1591 1592 /** 1593 * Gets the mobile subscriber ISDN number. Corresponds to the 1594 * {@code msisdn} claim. 1595 * 1596 * @return The mobile subscriber ISDN number, {@code null} if not 1597 * specified. 1598 */ 1599 public MSISDN getMSISDN() { 1600 1601 String value = getStringClaim(MSISDN_CLAIM_NAME); 1602 1603 if (value == null) { 1604 return null; 1605 } 1606 1607 try { 1608 return MSISDN.parse(value); 1609 } catch (ParseException e) { 1610 return null; 1611 } 1612 } 1613 1614 1615 /** 1616 * Sets the mobile subscriber ISDN number. Corresponds to the 1617 * {@code msisdn} claim. 1618 * 1619 * @param msisdn The mobile subscriber ISDN number. If {@code null} the 1620 * claim will be removed. 1621 */ 1622 public void setMSISDN(final MSISDN msisdn) { 1623 1624 String value = msisdn != null ? msisdn.getValue() : null; 1625 setClaim(MSISDN_CLAIM_NAME, value); 1626 } 1627 1628 1629 // also_known_as 1630 1631 1632 /** 1633 * Gets the also known as. Corresponds to the {@code also_known_as} 1634 * claim from OpenID Connect for Identity Assurance 1.0, with no 1635 * language tag. 1636 * 1637 * @return The also_known_as, {@code null} if not specified. 1638 */ 1639 public String getAlsoKnownAs() { 1640 1641 return getStringClaim(ALSO_KNOWN_AS); 1642 } 1643 1644 1645 /** 1646 * Gets the also known as. Corresponds to the {@code also_known_as} 1647 * claim from OpenID Connect for Identity Assurance 1.0, with an 1648 * optional language tag. 1649 * 1650 * @param langTag The language tag of the entry, {@code null} to get 1651 * the non-tagged entry. 1652 * 1653 * @return The also known as, {@code null} if not specified. 1654 */ 1655 public String getAlsoKnownAs(final LangTag langTag) { 1656 1657 return getStringClaim(ALSO_KNOWN_AS, langTag); 1658 } 1659 1660 1661 /** 1662 * Gets the also known as entries. Correspond to the 1663 * {@code also_known_as} claim from OpenID Connect for Identity 1664 * Assurance 1.0. 1665 * 1666 * @return The also known as entries, empty map if none. 1667 */ 1668 public Map<LangTag,String> getAlsoKnownAsEntries() { 1669 1670 return getLangTaggedClaim(ALSO_KNOWN_AS, String.class); 1671 } 1672 1673 1674 /** 1675 * Sets the also known as. Corresponds to the {@code also_known_as} 1676 * claim from OpenID Connect for Identity Assurance 1.0. 1677 * 1678 * @param alsoKnownAs The also known as, {@code null} if not specified. 1679 */ 1680 public void setAlsoKnownAs(final String alsoKnownAs) { 1681 1682 setClaim(ALSO_KNOWN_AS, alsoKnownAs); 1683 } 1684 1685 1686 /** 1687 * Sets the also known as. Corresponds to the {@code also_known_as} 1688 * claim from OpenID Connect for Identity Assurance 1.0, with an 1689 * optional language tag. 1690 * 1691 * @param alsoKnownAs The also known as. If {@code null} the claim will 1692 * be removed. 1693 * @param langTag The language tag, {@code null} if not specified. 1694 */ 1695 public void setAlsoKnownAs(final String alsoKnownAs, final LangTag langTag) { 1696 1697 setClaim(ALSO_KNOWN_AS, alsoKnownAs, langTag); 1698 } 1699}