public static String getPrincipalType(Principal userID) { if (userID instanceof X500Principal) { return IdentityType.X500.getValue().toLowerCase(); } if (userID instanceof HttpPrincipal) { return IdentityType.USERNAME.getValue().toLowerCase(); } if (userID instanceof NumericPrincipal) { return IdentityType.CADC.getValue().toLowerCase(); } return null; } }
public static IdentityType toValue(String s) { for (IdentityType type : values()) if (type.value.equals(s)) return type; throw new IllegalArgumentException("invalid value: " + s); }
public static Principal createPrincipal(String userID, String idType) { if (IdentityType.X500.getValue().equalsIgnoreCase(idType)) { return new X500Principal( AuthenticationUtil.canonizeDistinguishedName(userID)); } if (IdentityType.USERNAME.getValue().equalsIgnoreCase(idType)) { return new HttpPrincipal(userID); } if (IdentityType.CADC.getValue().equalsIgnoreCase(idType)) { return new NumericPrincipal(UUID.fromString(userID)); } return null; }
if ((identity instanceof HttpPrincipal)) identityElement.setAttribute(TYPE, IdentityType.USERNAME.getValue()); identityElement.setAttribute(TYPE, IdentityType.CADC.getValue()); identityElement.setAttribute(TYPE, IdentityType.OPENID.getValue()); identityElement.setAttribute(TYPE, IdentityType.X500.getValue()); identityElement.setAttribute(TYPE, IdentityType.ENTRY_DN.getValue());
log.debug("key = value: " + key + "=" + value); if (key.equalsIgnoreCase(IdentityType.USERID.getValue())) { userid = value; } else if (key.equalsIgnoreCase(PROXY_LABEL)) { proxyUser = value; } else if (key.equalsIgnoreCase(IdentityType.X500.getValue().toLowerCase())) { principalSet.add(new X500Principal(value)); else if (key.equalsIgnoreCase(IdentityType.NUMERICID.getValue()) || key.equalsIgnoreCase(IdentityType.CADC.getValue())) { principalSet.add(new NumericPrincipal(UUID.fromString(value))); } else if (key.equalsIgnoreCase(EXPIRY_LABEL)) {