Skip to content
This repository has been archived by the owner on May 10, 2022. It is now read-only.

Commit

Permalink
add log infos about auth login
Browse files Browse the repository at this point in the history
  • Loading branch information
huangwei5 committed Jan 18, 2019
1 parent 538ed12 commit cd1a033
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,35 +73,38 @@ public ClusterManager(
}

if (openAuth) {
logger.info("Open authentication");
logger.info("open authentication");
this.openAuth = openAuth;
this.serviceName = serviceName;
this.serviceFqdn = serviceFqdn;

String jaasConf = System.getProperties().getProperty("java.security.auth.login.config");
if (jaasConf == null) {
System.setProperty("java.security.auth.login.config", "configuration/jaas.conf");
logger.info("use the default jaas config path: configuration/jaas.conf");
System.setProperty("java.security.auth.login.config", "configuration/pegasus_jaas.conf");
jaasConf = System.getProperties().getProperty("java.security.auth.login.config");
}
logger.info("open authentication, jaas config path: {}, login now", jaasConf);

try {
loginContext = new LoginContext(
"client",
new TextCallbackHandler());
} catch (LoginException le) {
logger.error("Cannot create LoginContext. LoginException: {}", le.getMessage());
System.exit(-1); // TODO HW 错误处理
logger.error("cannot create LoginContext. LoginException: {}", le.getMessage());
System.exit(-1);
} catch (SecurityException se) {
logger.error("Cannot create LoginContext. SecurityException: {}", se.getMessage());
logger.error("cannot create LoginContext. SecurityException: {}", se.getMessage());
System.exit(-1);
}
try {
loginContext.login();
} catch (LoginException le) {
logger.error("Authentication failed: {}", le.getMessage());
logger.error("authentication failed: {}", le.getMessage());
System.exit(-1);
}

subject = loginContext.getSubject();
logger.info("login succeed, as user {}", subject.getPrincipals().toString());
}

replicaSessions = new ConcurrentHashMap<rpc_address, ReplicaSession>();
Expand Down

0 comments on commit cd1a033

Please sign in to comment.