4 Replies Latest reply on Mar 28, 2018 3:08 AM by qkxy

    Why Elytron realms are limited to use NamePrincipal only

    qkxy Newbie

      Hi all,

       

      I found that every realm implementation contains this limitation:

      public RealmIdentity getRealmIdentity(final Principal principal) {
        if (! (principal instanceof NamePrincipal)) {
        return RealmIdentity.NON_EXISTENT;
        }
      

       

      This makes impossible to use aggregate realm with a not Elytron implemented realm

      eg. I tried to use Keycloak with properties realm and this constraint makes it impossible.

       

      I think that it should be modify to check the existence of the principal and if it has a name eg.:

          public RealmIdentity getRealmIdentity(final Principal principal) {
              if (principal==null || principal.getName()==null || principal.getName().isEmpty()) {
                  return RealmIdentity.NON_EXISTENT;
              }
      

       

      NamePrincipal is declared as final so it can not be extended.

       

      What do you think?