本文整理汇总了Java中com.atlassian.seraph.auth.Authenticator类的典型用法代码示例。如果您正苦于以下问题:Java Authenticator类的具体用法?Java Authenticator怎么用?Java Authenticator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Authenticator类属于com.atlassian.seraph.auth包,在下文中一共展示了Authenticator类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: authenticateUserAndLogin
import com.atlassian.seraph.auth.Authenticator; //导入依赖的package包/类
protected void authenticateUserAndLogin(HttpServletRequest request,
HttpServletResponse response, String username)
throws Exception {
Authenticator authenticator = SecurityConfigFactory.getInstance().getAuthenticator();
if (authenticator instanceof ConfluenceAuthenticator) {
UserAccessor userAccessor = (UserAccessor) ContainerManager.getComponent("userAccessor");
ConfluenceUser confluenceUser = userAccessor.getUserByName(username);
if (confluenceUser == null) {
confluenceUser = tryCreateOrUpdateUser(username);
}
if (confluenceUser != null) {
Boolean result = authoriseUserAndEstablishSession((DefaultAuthenticator) authenticator, confluenceUser, request, response);
if (result) {
redirectToSuccessfulAuthLandingPage(request, response);
return;
}
}
}
redirectToLoginWithSAMLError(response, null, "user_not_found");
}
示例2: authenticateUserAndLogin
import com.atlassian.seraph.auth.Authenticator; //导入依赖的package包/类
protected void authenticateUserAndLogin(HttpServletRequest request,
HttpServletResponse response, String username)
throws Exception {
Authenticator authenticator = SecurityConfigFactory.getInstance().getAuthenticator();
if (authenticator instanceof DefaultAuthenticator) {
Method getUserMethod = DefaultAuthenticator.class.getDeclaredMethod("getUser", new Class[]{String.class});
getUserMethod.setAccessible(true);
Object userObject = getUserMethod.invoke(authenticator, new Object[]{username});
// if not found, see if we're allowed to auto-create the user
if (userObject == null) {
userObject = tryCreateOrUpdateUser(username);
}
if(userObject != null && userObject instanceof ApplicationUser) {
Boolean result = authoriseUserAndEstablishSession((DefaultAuthenticator) authenticator, userObject, request, response);
if (result) {
redirectToSuccessfulAuthLandingPage(request, response);
return;
}
}
}
redirectToLoginWithSAMLError(response, null, "user_not_found");
}
示例3: getAuthenticator
import com.atlassian.seraph.auth.Authenticator; //导入依赖的package包/类
@Override
public Authenticator getAuthenticator() {
return null;
}