String username = openId.getClaimedId();
String subject = relyingPartyManager.getRequestSubject(openId);
log.info("GET VOMS Proxy for \"" + subject + "\"");
GSSCredential credential = proxyInit.getVomsProxy(subject);
User gsUser = gsUserManager.getUserByUserName(username);
if (gsUser == null) {
log.info("User \"" + username + "\" is not exists.");
gsUser = gsUserManager.importUser(username);
log.info("User \"" + username + "\" was imported");
} else if (gsUser.getAttribute("tsukubagama.type") != null){
log.info("Got imported Tsukuba GAMA User");
} else {
log.error("GridSphere User \"" + username + "\" is already exists.");
return null;
}
credentialManager.activate(gsUser, credential);
return new UserDescriptor(null, gsUser.getID(), gsUser.getUserName());
}