当前位置: 首页>>代码示例>>Java>>正文


Java Authenticator类代码示例

本文整理汇总了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");
}
 
开发者ID:bitium,项目名称:confluence-saml-plugin,代码行数:27,代码来源:SsoConfluenceLoginServlet.java

示例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");
}
 
开发者ID:bitium,项目名称:jira-saml-plugin,代码行数:29,代码来源:SsoJiraLoginServlet.java

示例3: getAuthenticator

import com.atlassian.seraph.auth.Authenticator; //导入依赖的package包/类
@Override
public Authenticator getAuthenticator() {
	
	return null;
}
 
开发者ID:mschieder,项目名称:jira-pvp-sso,代码行数:6,代码来源:FakeSecurityConfig.java


注:本文中的com.atlassian.seraph.auth.Authenticator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。