@Test public void getPrincipalShouldBeEqualForSameUser() throws IOException { Token userToken2 = new XsuaaToken(IOUtils.resourceToString("/xsuaaUserAccessTokenRSA256.txt", UTF_8)); assertThat(userToken.getPrincipal()).isEqualTo(userToken2.getPrincipal()); }
@Override public Principal getPrincipal() { String principalName; switch (getGrantType()) { case CLIENT_CREDENTIALS: case CLIENT_X509: principalName = String.format(UNIQUE_CLIENT_NAME_FORMAT, getClaimAsString(CLIENT_ID)); break; default: principalName = getUniquePrincipalName(getClaimAsString(ORIGIN), getClaimAsString(USER_NAME)); break; } return createPrincipalByName(principalName); }
XsuaaToken extends AbstractToken implements AccessToken { @Override public Principal getPrincipal() { String principalName; switch (getGrantType()) { case CLIENT_CREDENTIALS: case CLIENT_X509: principalName = String.format(UNIQUE_CLIENT_NAME_FORMAT, getClaimAsString(CLIENT_ID)); break; default: principalName = getUniquePrincipalName(getClaimAsString(ORIGIN), getClaimAsString(USER_NAME)); break; } return createPrincipalByName(principalName); } }
XsuaaToken extends AbstractToken implements AccessToken { @Override public Principal getPrincipal() { String principalName; switch (getGrantType()) { case CLIENT_CREDENTIALS: case CLIENT_X509: principalName = String.format(UNIQUE_CLIENT_NAME_FORMAT, getClaimAsString(CLIENT_ID)); break; default: principalName = getUniquePrincipalName(getClaimAsString(ORIGIN), getClaimAsString(USER_NAME)); break; } return createPrincipalByName(principalName); } XsuaaToken(@Nonnull DecodedJwt decodedJwt);  XsuaaToken(@Nonnull String accessToken); }
XsuaaToken extends AbstractToken implements AccessToken { @Override public Principal getPrincipal() { String principalName; switch (getGrantType()) { case CLIENT_CREDENTIALS: case CLIENT_X509: principalName = String.format(UNIQUE_CLIENT_NAME_FORMAT, getClaimAsString(CLIENT_ID)); break; default: principalName = getUniquePrincipalName(getClaimAsString(ORIGIN), getClaimAsString(USER_NAME)); break; } return createPrincipalByName(principalName); } XsuaaToken(@Nonnull DecodedJwt decodedJwt);  XsuaaToken(@Nonnull String accessToken); XsuaaToken withScopeConverter(@Nullable ScopeConverter converter); @Override Set<String> getScopes(); @Override Principal getPrincipal(); @Override Service getService(); @Override boolean hasScope(String scope); @Override boolean hasLocalScope(@Nonnull String scope); @Override GrantType getGrantType(); @Nullable String getSubdomain(); @Nullable String getSubaccountId(); @Override String getZoneId(); }
XsuaaToken extends AbstractToken implements AccessToken { @Override public Principal getPrincipal() { String principalName; switch (getGrantType()) { case CLIENT_CREDENTIALS: case CLIENT_X509: principalName = String.format(UNIQUE_CLIENT_NAME_FORMAT, getClaimAsString(CLIENT_ID)); break; default: principalName = getUniquePrincipalName(getClaimAsString(ORIGIN), getClaimAsString(USER_NAME)); break; } return createPrincipalByName(principalName); } XsuaaToken(@Nonnull DecodedJwt decodedJwt);  XsuaaToken(@Nonnull String accessToken); XsuaaToken withScopeConverter(@Nullable ScopeConverter converter); @Override Set<String> getScopes(); @Override Principal getPrincipal(); @Override Service getService(); @Override boolean hasScope(String scope); @Override boolean hasLocalScope(@Nonnull String scope); @Override GrantType getGrantType(); @Nullable String getSubdomain(); @Nullable String getSubaccountId(); @Override String getZoneId();  }