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

Java Credentials类代码示例

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

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



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

示例1: validatorCaptcha

import org.jasig.cas.authentication.principal.Credentials; //导入依赖的package包/类
public final String validatorCaptcha(final RequestContext context, final Credentials credentials, final MessageContext messageContext) throws Exception {
	final HttpServletRequest request = WebUtils.getHttpServletRequest(context);  
    HttpSession session = request.getSession();  
    String authcode = (String)session.getAttribute(com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY);  
    session.removeAttribute(com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY);  
    UsernamePasswordCaptchaCredentials upc = (UsernamePasswordCaptchaCredentials)credentials;  
    String submitAuthcode =upc.getCaptcha();  
    if(!StringUtils.hasText(submitAuthcode) || !StringUtils.hasText(authcode)){  
        populateErrorsInstance(new NullAuthCaptchaAuthenticationException(CAPTCHA_REQUIRED_MSG),messageContext);  
        return "error";    
    }  
    if(submitAuthcode.equals(authcode)){    
        return "success";  
    }  
    populateErrorsInstance(new BadAuthCaptchaAuthenticationException(CAPTCHA_ERROR_MSG),messageContext);  
    return "error";
}
 
开发者ID:ameizi,项目名称:cas-oauth-example-3.5.x,代码行数:18,代码来源:CaptchaVaditeAuthenticationViaFormAction.java


示例2: convert

import org.jasig.cas.authentication.principal.Credentials; //导入依赖的package包/类
@Override
public Credentials convert(final Credential credential) {
    if (!(credential instanceof UsernamePasswordCredential)) {
        throw new IllegalArgumentException(credential + " not supported.");
    }
    final UsernamePasswordCredential original = (UsernamePasswordCredential) credential;
    final UsernamePasswordCredentials old = new UsernamePasswordCredentials();
    old.setUsername(original.getUsername());
    old.setPassword(original.getPassword());
    return old;
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:12,代码来源:UsernamePasswordCredentialsAdapter.java


示例3: supports

import org.jasig.cas.authentication.principal.Credentials; //导入依赖的package包/类
/**
 * Return true if Credentials are UsernamePasswordCredentials, false
 * otherwise.
 */
@Override
public boolean supports(final Credentials credentials) {
    return credentials != null
            && UsernamePasswordCredentials.class.isAssignableFrom(credentials
                    .getClass());
}
 
开发者ID:caratarse,项目名称:caratarse-auth,代码行数:11,代码来源:TransformedUsernamePasswordCredentialToPrincipalResolver.java


示例4: authenticate

import org.jasig.cas.authentication.principal.Credentials; //导入依赖的package包/类
/**
 * Authenticate the user credentials and retrieve samlAssertion for authentication Service
 * Obtain the GlobusCredential for the Authenticated User from Dorian
 * Validate the Proxy or GlobusCredential
 * Delegate the Globus Credentials
 * Adding the serialized Delegated Credentials Reference and Grid Identity to the attributes map
 * Create the Principal from the grid identity
 * Create a new Authentication Object using the Principal
 */
@SuppressWarnings("unchecked")
public Authentication authenticate(Credentials credentials)
		throws AuthenticationException {
	if (null == webSSOProperties) {
		throw new AuthenticationConfigurationException(
				"Error Initializing Authentication Manager properties");
	}
	UsernamePasswordAuthenticationServiceURLCredentials userNameCredentials=(UsernamePasswordAuthenticationServiceURLCredentials)credentials;
	SAMLAssertion samlAssertion = authenticationServiceHelper.authenticate(
			userNameCredentials.getAuthenticationServiceURL(),userNameCredentials.getCredential());

	DorianInformation dorianInformation = this.getDorianInformation(userNameCredentials.getDorianName());
	GlobusCredential globusCredential = dorianHelper.obtainProxy(samlAssertion, dorianInformation);
	proxyValidator.validate(globusCredential);
	String serializedDelegatedCredentialReference = gridCredentialDelegator
													.delegateGridCredential(globusCredential, this.getHostIdentities());

	Map<String, Object> attributesMap = (Map<String, Object>)samlToAttributeMapper.convertSAMLtoHashMap(samlAssertion);
	attributesMap.put(WebSSOConstants.CAGRID_SSO_DELEGATION_SERVICE_EPR, serializedDelegatedCredentialReference);
	attributesMap.put(WebSSOConstants.CAGRID_SSO_GRID_IDENTITY, globusCredential.getIdentity());
	
	String principal = this.constructPrincipal(attributesMap);
	
	Principal p = new SimplePrincipal(principal,attributesMap);
	MutableAuthentication mutableAuthentication = new MutableAuthentication(p);
	return mutableAuthentication;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:37,代码来源:CaGridAuthenticationManager.java


示例5: authenticate

import org.jasig.cas.authentication.principal.Credentials; //导入依赖的package包/类
@Override
public boolean authenticate(final Credentials credential) throws AuthenticationException {
    return true;
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:5,代码来源:TestAlwaysPassAuthenticationHandler.java


示例6: supports

import org.jasig.cas.authentication.principal.Credentials; //导入依赖的package包/类
@Override
public boolean supports(final Credentials credential) {
    return true;
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:5,代码来源:TestAlwaysPassAuthenticationHandler.java


示例7: authenticate

import org.jasig.cas.authentication.principal.Credentials; //导入依赖的package包/类
@Override
public boolean authenticate(final Credentials credential) throws AuthenticationException {
    return false;
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:5,代码来源:TestAlwaysFailAuthenticationHandler.java


示例8: extractPrincipalId

import org.jasig.cas.authentication.principal.Credentials; //导入依赖的package包/类
@Override
protected String extractPrincipalId(final Credentials credentials) {
    final UsernamePasswordCredentials usernamePasswordCredentials = (UsernamePasswordCredentials) credentials;
    return principalNameTransformer.transform(usernamePasswordCredentials.getUsername());
}
 
开发者ID:caratarse,项目名称:caratarse-auth,代码行数:6,代码来源:TransformedUsernamePasswordCredentialToPrincipalResolver.java


示例9: constructCredentialsFromRequest

import org.jasig.cas.authentication.principal.Credentials; //导入依赖的package包/类
protected Credentials constructCredentialsFromRequest(
    final RequestContext context) {
    final HttpServletRequest request = WebUtils
        .getHttpServletRequest(context);
    final String remoteUser = request.getRemoteUser();

    if (StringUtils.hasText(remoteUser)) {
        if (logger.isDebugEnabled()) {
            logger.debug("Remote  User [" + remoteUser
                + "] found in HttpServletRequest");
        }

        /**
         * Grab the Shibboleth attributes from the HTTP headers, create a
         * map of them, and include the, in the SimplePrincipal.
         */
        HashMap<String, Object> attributes = new HashMap<String, Object>();

        Enumeration en = request.getHeaderNames();
        while (en.hasMoreElements()) {
            String name = (String) en.nextElement();
            if (name.startsWith("shibattr-") || name.startsWith("Shib-")) {
                ArrayList<String> valueList = new ArrayList<String>();
                Enumeration en2 = request.getHeaders(name);
                while (en2.hasMoreElements()) {
                    String value = (String) en2.nextElement();
                    if (value.length() > 0) {
                        valueList.add(value);
                    }
                }
                if (valueList.size() > 0) {
                    if (name.startsWith("shibattr-"))
                        attributes.put(
                            name.substring("shibattr-".length()),
                            (valueList.size() == 1 ? valueList.get(0)
                                : valueList));
                    else
                        attributes.put(name,
                            (valueList.size() == 1 ? valueList.get(0)
                                : valueList));
                }
            }
        }

        return new PrincipalBearingCredentials(new SimplePrincipal(
            remoteUser, attributes));
    }

    if (logger.isDebugEnabled()) {
        logger.debug("Remote User not found in HttpServletRequest.");
    }

    return null;
}
 
开发者ID:UniconLabs,项目名称:casshib,代码行数:55,代码来源:PrincipalFromHttpHeadersNonInteractiveCredentialsAction.java


示例10: extractPrincipalId

import org.jasig.cas.authentication.principal.Credentials; //导入依赖的package包/类
protected String extractPrincipalId(Credentials credentials) {
    return ((PrincipalBearingCredentials) credentials).getPrincipal()
        .getId();
}
 
开发者ID:UniconLabs,项目名称:casshib,代码行数:5,代码来源:PrincipalBearingCredentialsToPrincipalWithAttributesResolver.java


示例11: supports

import org.jasig.cas.authentication.principal.Credentials; //导入依赖的package包/类
public boolean supports(final Credentials credentials) {
    return credentials != null
        && credentials.getClass().equals(PrincipalBearingCredentials.class);
}
 
开发者ID:UniconLabs,项目名称:casshib,代码行数:5,代码来源:PrincipalBearingCredentialsToPrincipalWithAttributesResolver.java


示例12: resolvePrincipal

import org.jasig.cas.authentication.principal.Credentials; //导入依赖的package包/类
public Principal resolvePrincipal(final Credentials credentials) {
    return (credentials != null ? ((PrincipalBearingCredentials) credentials)
        .getPrincipal()
        : null);
}
 
开发者ID:UniconLabs,项目名称:casshib,代码行数:6,代码来源:PrincipalBearingCredentialsToPrincipalWithAttributesResolver.java


示例13: authenticate

import org.jasig.cas.authentication.principal.Credentials; //导入依赖的package包/类
public Authentication authenticate(Credentials credentials) throws AuthenticationException
{
	if (null == webSSOProperties)
	{
		throw new AuthenticationConfigurationException ("Error Initializing Authentication Manager properties");
	}
	
	// Obtain the implementation for the AuthenticationServiceHelper Interface
	AuthenticationServiceHelper authenticationServiceHelper = (AuthenticationServiceHelper)ObjectFactory.getObject(WebSSOConstants.AUTHENTICATION_SERVICE_HELPER);
	
	// Authenticate the user credentials and retrieve 
	SAMLAssertion samlAssertion = authenticationServiceHelper.authenticate(getAuthenticationServiceURL(), ((UsernamePasswordCredentials) credentials).getUsername(), ((UsernamePasswordCredentials) credentials).getPassword());

	// Obtain the implementation for the DorianHelper Interface
	DorianHelper dorianHelper = (DorianHelper) ObjectFactory.getObject(WebSSOConstants.DORIAN_HELPER);
	
	// Obtained the GlobusCredential for the Authenticated User
	GlobusCredential globusCredential = dorianHelper.obtainProxy(samlAssertion);
	this.credentials = globusCredential;
	
	// Obtain the implementation for the GridCredentialsDelegator Interface
	GridCredentialDelegator gridCredentialDelegator = (GridCredentialDelegator)ObjectFactory.getObject(WebSSOConstants.GRID_CREDENTIAL_DELEGATOR);
	
	// Delegate the Globus Credentials
	String serializedDelegatedCredentialReference = gridCredentialDelegator.delegateGridCredential(globusCredential, dorianHelper.getProxyLifetime(), this.getHostIdentities());
       this.serializedDelegationEpr = serializedDelegatedCredentialReference;		 
	// Obtain the implementation for the SAMLToAttributeMapper Interface
	SAMLToAttributeMapper samlToAttributeMapper = (SAMLToAttributeMapper)ObjectFactory.getObject(WebSSOConstants.SAML_TO_ATTRIBUTE_MAPPER);  

	HashMap<String, String> attributesMap = samlToAttributeMapper.convertSAMLtoHashMap(samlAssertion);

	// Adding the serialed Delegated Credentails Reference and Grid Identity to the 
	attributesMap.put(WebSSOConstants.CAGRID_SSO_DELEGATION_SERVICE_EPR, serializedDelegatedCredentialReference);
	attributesMap.put(WebSSOConstants.CAGRID_SSO_GRID_IDENTITY, globusCredential.getIdentity());
	
	// Creating the Principal from the grid identity
	Principal p = new SimplePrincipal(this.constructPrincipal(attributesMap));

	// Create a new Authentication Object using the Principal
	MutableAuthentication mutableAuthentication = new MutableAuthentication(p);
	
	return mutableAuthentication;
		
}
 
开发者ID:NCIP,项目名称:labviewer,代码行数:45,代码来源:CaGridAuthenticationManager.java


示例14: authenticate

import org.jasig.cas.authentication.principal.Credentials; //导入依赖的package包/类
/**
 * Method to determine if the credential supplied are valid.
 *
 * @param credential The credential to validate.
 * @return true if valid, return false otherwise.
 * @throws AuthenticationException An AuthenticationException can contain
 * details about why a particular authentication request failed.
 */
boolean authenticate(Credentials credential)
    throws AuthenticationException;
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:11,代码来源:AuthenticationHandler.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java IntervalCategoryItemLabelGenerator类代码示例发布时间:2022-05-22
下一篇:
Java CacheAtomicityMode类代码示例发布时间: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