• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java AuthenticationServiceException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.acegisecurity.AuthenticationServiceException的典型用法代码示例。如果您正苦于以下问题:Java AuthenticationServiceException类的具体用法?Java AuthenticationServiceException怎么用?Java AuthenticationServiceException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AuthenticationServiceException类属于org.acegisecurity包,在下文中一共展示了AuthenticationServiceException类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: authenticate

import org.acegisecurity.AuthenticationServiceException; //导入依赖的package包/类
@Override
protected UserDetails authenticate(String username, String password) throws AuthenticationException {
    try {
        LOGGER.info("Trying to authenticate with username: " + username);
        GitlabSession session = GitlabAPI.connect(this.gitLabUrl, username, password);
        return this.userDetailsBuilder.buildUserDetails(this.gitLabUrl, session, session.getPrivateToken());
    } catch(Exception e) {
        this.LOGGER.log(Level.WARNING, "Authentication request failed for username: " + username, e);
        throw new AuthenticationServiceException("Unable to process authentication for username: " + username, e);
    }
}
 
开发者ID:andreptb,项目名称:jenkins-gitlab-security-plugin,代码行数:12,代码来源:GitLabSecurityRealm.java


示例2: retrieveUser

import org.acegisecurity.AuthenticationServiceException; //导入依赖的package包/类
protected final UserDetails retrieveUser(String username, UsernamePasswordAuthenticationToken authentication)
    throws AuthenticationException {
    UserDetails loadedUser;

    try {
    	// Check if User is Authenticated. ?? TODO
    	
        loadedUser = this.getUserDetailsService().loadUserByUsername(username);
    } catch (DataAccessException repositoryProblem) {
        throw new AuthenticationServiceException(repositoryProblem.getMessage(), repositoryProblem);
    }

    if (loadedUser == null) {
        throw new AuthenticationServiceException(
            "UserDetailsService returned null, which is an interface contract violation");
    }

    return loadedUser;
}
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:20,代码来源:CSMAuthenticationProvider.java


示例3: authenticate

import org.acegisecurity.AuthenticationServiceException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * 
 * @see hudson.security.AbstractPasswordBasedSecurityRealm#authenticate(java.lang.String, java.lang.String)
 */
@Override
protected UserDetails authenticate(String username, String password) throws AuthenticationException {
    try {
        RedmineManager currentManager = getUserRedmineManager(username, password);
        return getUserDetails(currentManager.getCurrentUser());
    } catch (RedmineException e) {
        LOGGER.error("login failed for user {}: {}", username, e.getMessage(), e);
        throw new AuthenticationServiceException("login failed for user " + username, e);
    }
}
 
开发者ID:cyrilix,项目名称:jenkins-redmine-realm,代码行数:16,代码来源:RedmineSecurityRealm.java


示例4: attemptAuthentication

import org.acegisecurity.AuthenticationServiceException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Authentication attemptAuthentication(HttpServletRequest request) {
    // Based on AppScan failing because of a "Cross-Site Request Forgery"
    if (StringUtils.isBlank(request.getRequestedSessionId())
        || !request.getRequestedSessionId().equals(request.getSession().getId())) {
        throw new AuthenticationServiceException("The session ID is not attached with this request.");
    }
    request.getSession().invalidate();
    request.getSession(true);
    return super.attemptAuthentication(request);
}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:15,代码来源:Cai2AuthenticationProcessingFilter.java


示例5: validateNow

import org.acegisecurity.AuthenticationServiceException; //导入依赖的package包/类
/**
     * This overridden method gets the authentication source and 
     * Distributed Session Ticket from the response
     * 
     * @see org.acegisecurity.providers.cas.ticketvalidator.CasProxyTicketValidator#validateNow(edu.yale.its.tp.cas.client.ProxyTicketValidator)
     */
    protected TicketResponse validateNow(ProxyTicketValidator pv)
        throws AuthenticationServiceException, BadCredentialsException {
		String					sAuthenticationSource = null;
		String                  sDST = null;

        try {
            pv.validate();
        } catch (Exception internalProxyTicketValidatorProblem) {
            throw new AuthenticationServiceException(internalProxyTicketValidatorProblem.getMessage());
        }

        if (!pv.isAuthenticationSuccesful()) {
            throw new BadCredentialsException(pv.getErrorCode() + ": " + pv.getErrorMessage());
        }
        
        logger.debug("PROXY RESPONSE: " + pv.getResponse());
        
        if (logger.isDebugEnabled()) {
            logger.debug("DEBUG");
        }
                
        try {
			DocumentBuilderFactory	factory = DocumentBuilderFactory.newInstance();
			DocumentBuilder			builder = factory.newDocumentBuilder();
			InputSource inStream = new InputSource();
			inStream.setCharacterStream(new StringReader(pv.getResponse()));
			Document				doc     = builder.parse(inStream);
			Element 				head = doc.getDocumentElement();
			NodeList 				attrs = head.getElementsByTagName("cas:attribute");
			for (int i=0; i<attrs.getLength(); i++) {
				logger.debug(("Field name:" + ((Element)attrs.item(i)).getAttribute("name")) + "=" + ((Element)attrs.item(i)).getAttribute("value"));
				if ( ((Element)attrs.item(i)).getAttribute("name").equals("authenticationMethod") ) {
					sAuthenticationSource = ((Element)attrs.item(i)).getAttribute("value");
				} else if ( ((Element)attrs.item(i)).getAttribute("name").equals("DST") ) {
				    sDST = ((Element)attrs.item(i)).getAttribute("value");
				}
			}
			if (sAuthenticationSource != null && sDST != null) {
                String sPrincipal = pv.getUser() + "@" + sAuthenticationSource;

                if (logger.isDebugEnabled()) {
			        logger.debug("Updating session: " + sDST + " " + sPrincipal);
			    }
// Touching here may be overkill since it should happen in the filter
                distributedSession.touchSesn(sDST);
              //  distributedSession.addPrincipalToSesn(sDST, sPrincipal);
			} else {
			    if (logger.isDebugEnabled()) {
                    logger.debug("Incomplete data from CAS:" + sAuthenticationSource + ":" + sDST);
                }
			}
        } catch (Exception e) {
        	logger.error("Error parsing CAS Result", e);
        }
        
        logger.debug("Authentication Method:" + sAuthenticationSource);
        return new KualiTicketResponse(pv.getUser(), pv.getProxyList(), pv.getPgtIou(), sDST);
    }
 
开发者ID:kuali,项目名称:rice,代码行数:65,代码来源:KualiCasProxyTicketValidator.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MultiReducerProcessor类代码示例发布时间:2022-05-22
下一篇:
Java NoSuchObjectLocalException类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap