@Test public void getUserPrincipal() { assertThat(userToken.getClaimAsString(TokenClaims.USER_NAME)).isEqualTo("testUser"); assertThat(userToken.getClaimAsString(TokenClaims.XSUAA.ORIGIN)).isEqualTo("userIdp"); assertThat(userToken.getPrincipal()).isNotNull(); assertThat(userToken.getPrincipal().getName()).isEqualTo("user/userIdp/testUser"); }
@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();  }