use of com.sun.security.auth.NTSidDomainPrincipal in project jdk8u_jdk by JetBrains.
the class NTLoginModule method login.
/**
* Import underlying NT system identity information.
*
* <p>
*
* @return true in all cases since this <code>LoginModule</code>
* should not be ignored.
*
* @exception FailedLoginException if the authentication fails. <p>
*
* @exception LoginException if this <code>LoginModule</code>
* is unable to perform the authentication.
*/
public boolean login() throws LoginException {
// Indicate not yet successful
succeeded = false;
ntSystem = new NTSystem(debugNative);
if (ntSystem == null) {
if (debug) {
System.out.println("\t\t[NTLoginModule] " + "Failed in NT login");
}
throw new FailedLoginException("Failed in attempt to import the " + "underlying NT system identity information");
}
if (ntSystem.getName() == null) {
throw new FailedLoginException("Failed in attempt to import the " + "underlying NT system identity information");
}
userPrincipal = new NTUserPrincipal(ntSystem.getName());
if (debug) {
System.out.println("\t\t[NTLoginModule] " + "succeeded importing info: ");
System.out.println("\t\t\tuser name = " + userPrincipal.getName());
}
if (ntSystem.getUserSID() != null) {
userSID = new NTSidUserPrincipal(ntSystem.getUserSID());
if (debug) {
System.out.println("\t\t\tuser SID = " + userSID.getName());
}
}
if (ntSystem.getDomain() != null) {
userDomain = new NTDomainPrincipal(ntSystem.getDomain());
if (debug) {
System.out.println("\t\t\tuser domain = " + userDomain.getName());
}
}
if (ntSystem.getDomainSID() != null) {
domainSID = new NTSidDomainPrincipal(ntSystem.getDomainSID());
if (debug) {
System.out.println("\t\t\tuser domain SID = " + domainSID.getName());
}
}
if (ntSystem.getPrimaryGroupID() != null) {
primaryGroup = new NTSidPrimaryGroupPrincipal(ntSystem.getPrimaryGroupID());
if (debug) {
System.out.println("\t\t\tuser primary group = " + primaryGroup.getName());
}
}
if (ntSystem.getGroupIDs() != null && ntSystem.getGroupIDs().length > 0) {
String[] groupSIDs = ntSystem.getGroupIDs();
groups = new NTSidGroupPrincipal[groupSIDs.length];
for (int i = 0; i < groupSIDs.length; i++) {
groups[i] = new NTSidGroupPrincipal(groupSIDs[i]);
if (debug) {
System.out.println("\t\t\tuser group = " + groups[i].getName());
}
}
}
if (ntSystem.getImpersonationToken() != 0) {
iToken = new NTNumericCredential(ntSystem.getImpersonationToken());
if (debug) {
System.out.println("\t\t\timpersonation token = " + ntSystem.getImpersonationToken());
}
}
succeeded = true;
return succeeded;
}
Aggregations