byte[] principalNameToken = identityToken.principal_name();
Any any = null;
try {
any = Util.getCodec().decode_value(principalNameToken, GSS_NT_ExportedNameHelper.type());
} catch (FormatMismatch formatMismatch) {
throw new SASException(1, formatMismatch);
} catch (TypeMismatch typeMismatch) {
throw new SASException(1, typeMismatch);
}
byte[] principalNameBytes = GSS_NT_ExportedNameHelper.extract(any);
String principalName = Util.decodeGSSExportName(principalNameBytes);
principalName = Util.extractUserNameFromScopedName(principalName);
Principal basePrincipal = null;
try {
getConstructor();
basePrincipal = (Principal) constructor.newInstance(new Object[]{principalName});
} catch (InstantiationException e) {
throw new SASException(1, e);
} catch (IllegalAccessException e) {
throw new SASException(1, e);
} catch (InvocationTargetException e) {
throw new SASException(1, e);
} catch (NoSuchMethodException e) {
throw new SASException(1, e);
}
Subject subject = new Subject();
subject.getPrincipals().add(basePrincipal);
if (realmName != null && domainName != null) {