@Test public void getUniquePrincipalNameForOriginAndName() { String uniqueUserName = XsuaaToken.getUniquePrincipalName("origin", "name"); assertThat(uniqueUserName, is("user/origin/name")); }
@Nullable public static String getUniquePrincipalName(String origin, String userLoginName) { if (origin == null) { logger.warn("Origin claim not set in JWT. Cannot create unique user name. Returning null."); return null; } if (userLoginName == null) { logger.warn("User login name claim not set in JWT. Cannot create unique user name. Returning null."); return null; } if (origin.contains("/")) { logger.warn( "Illegal '/' character detected in origin claim of JWT. Cannot create unique user name. Returning null."); return null; } return String.format(UNIQUE_USER_NAME_FORMAT, origin, userLoginName); }
XsuaaToken extends Jwt implements Token { @Nullable public static String getUniquePrincipalName(String origin, String userLoginName) { if (origin == null) { logger.warn("Origin claim not set in JWT. Cannot create unique user name. Returning null."); return null; } if (userLoginName == null) { logger.warn("User login name claim not set in JWT. Cannot create unique user name. Returning null."); return null; } if (origin.contains("/")) { logger.warn( "Illegal '/' character detected in origin claim of JWT. Cannot create unique user name. Returning null."); return null; } return String.format(UNIQUE_USER_NAME_FORMAT, origin, userLoginName); } }
XsuaaToken extends Jwt implements Token { @Nullable public static String getUniquePrincipalName(String origin, String userLoginName) { if (origin == null) { logger.warn("Origin claim not set in JWT. Cannot create unique user name. Returning null."); return null; } if (userLoginName == null) { logger.warn("User login name claim not set in JWT. Cannot create unique user name. Returning null."); return null; } if (origin.contains("/")) { logger.warn( "Illegal '/' character detected in origin claim of JWT. Cannot create unique user name. Returning null."); return null; } return String.format(UNIQUE_USER_NAME_FORMAT, origin, userLoginName); } protected  XsuaaToken(Jwt jwt); }
XsuaaToken extends Jwt implements Token { @Nullable public static String getUniquePrincipalName(String origin, String userLoginName) { if (origin == null) { logger.warn("Origin claim not set in JWT. Cannot create unique user name. Returning null."); return null; } if (userLoginName == null) { logger.warn("User login name claim not set in JWT. Cannot create unique user name. Returning null."); return null; } if (origin.contains("/")) { logger.warn( "Illegal '/' character detected in origin claim of JWT. Cannot create unique user name. Returning null."); return null; } return String.format(UNIQUE_USER_NAME_FORMAT, origin, userLoginName); } protected  XsuaaToken(Jwt jwt); @Override Collection<? extends GrantedAuthority> getAuthorities(); @Override Date getExpirationDate(); @Override Instant getExpiration(); @Override String getPassword(); @Override String getUsername(); @Override boolean isAccountNonExpired(); @Override boolean isAccountNonLocked(); @Override boolean isCredentialsNonExpired(); @Override boolean isEnabled(); @Nullable static String getUniquePrincipalName(String origin, String userLoginName); @Override @Nullable String getLogonName(); @Override @Nullable String getClientId(); @Override String getGivenName(); @Override @Nullable String getFamilyName(); @Override String getEmail(); @Override String getOrigin(); @Override String getGrantType(); @Override String getSubaccountId(); @Override String getZoneId(); @Override String getSubdomain(); @Override String toString(); @Nullable @Override String[] getXSUserAttribute(String attributeName); @Override String getAdditionalAuthAttribute(String attributeName); @Override String getCloneServiceInstanceId(); @Override String getAppToken(); @Override Collection<String> getScopes(); boolean hasClaim(String claim); }
XsuaaToken extends Jwt implements Token { @Nullable public static String getUniquePrincipalName(String origin, String userLoginName) { if (origin == null) { logger.warn("Origin claim not set in JWT. Cannot create unique user name. Returning null."); return null; } if (userLoginName == null) { logger.warn("User login name claim not set in JWT. Cannot create unique user name. Returning null."); return null; } if (origin.contains("/")) { logger.warn( "Illegal '/' character detected in origin claim of JWT. Cannot create unique user name. Returning null."); return null; } return String.format(UNIQUE_USER_NAME_FORMAT, origin, userLoginName); } protected  XsuaaToken(Jwt jwt); @Override Collection<? extends GrantedAuthority> getAuthorities(); @Override Date getExpirationDate(); @Override Instant getExpiration(); @Override String getPassword(); @Override String getUsername(); @Override boolean isAccountNonExpired(); @Override boolean isAccountNonLocked(); @Override boolean isCredentialsNonExpired(); @Override boolean isEnabled(); @Nullable static String getUniquePrincipalName(String origin, String userLoginName); @Override @Nullable String getLogonName(); @Override @Nullable String getClientId(); @Override String getGivenName(); @Override @Nullable String getFamilyName(); @Override String getEmail(); @Override String getOrigin(); @Override String getGrantType(); @Override String getSubaccountId(); @Override String getZoneId(); @Override String getSubdomain(); @Override String toString(); @Nullable @Override String[] getXSUserAttribute(String attributeName); @Override String getAdditionalAuthAttribute(String attributeName); @Override String getCloneServiceInstanceId(); @Override String getAppToken(); @Override Collection<String> getScopes(); boolean hasClaim(String claim);  }