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


Java AuthenticationBuilder类代码示例

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


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

示例1: verifyAuthenticationTypeFoundCustom

import org.jasig.cas.authentication.AuthenticationBuilder; //导入依赖的package包/类
@Test
public void verifyAuthenticationTypeFoundCustom() {
    final CustomCredential credentials = new CustomCredential();

    final Map<String, String> added = new HashMap<>();
    added.put(CustomCredential.class.getName(), "FF");

    this.populator.setUserDefinedMappings(added);

    final AuthenticationBuilder builder = newAuthenticationBuilder(
            org.jasig.cas.authentication.TestUtils.getPrincipal());
    this.populator.populateAttributes(builder, credentials);
    final Authentication auth = builder.build();

    assertEquals(
            "FF",
            auth.getAttributes().get(SamlAuthenticationMetaDataPopulator.ATTRIBUTE_AUTHENTICATION_METHOD));
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:19,代码来源:SamlAuthenticationMetaDataPopulatorTests.java

示例2: verifyAuthenticationTypeFoundCustom

import org.jasig.cas.authentication.AuthenticationBuilder; //导入依赖的package包/类
@Test
public void verifyAuthenticationTypeFoundCustom() {
    final CustomCredential credentials = new CustomCredential();

    final Map<String, String> added = new HashMap<>();
    added.put(CustomCredential.class.getName(), "FF");

    this.populator.setUserDefinedMappings(added);

    final AuthenticationBuilder builder = newAuthenticationBuilder(TestUtils.getPrincipal());
    this.populator.populateAttributes(builder, credentials);
    final Authentication auth = builder.build();

    assertEquals(
            "FF",
            auth.getAttributes().get(SamlAuthenticationMetaDataPopulator.ATTRIBUTE_AUTHENTICATION_METHOD));
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:18,代码来源:SamlAuthenticationMetaDataPopulatorTests.java

示例3: testAuthenticationTypeFoundCustom

import org.jasig.cas.authentication.AuthenticationBuilder; //导入依赖的package包/类
@Test
public void testAuthenticationTypeFoundCustom() {
    final CustomCredential credentials = new CustomCredential();

    final Map<String, String> added = new HashMap<String, String>();
    added.put(CustomCredential.class.getName(), "FF");

    this.populator.setUserDefinedMappings(added);

    final AuthenticationBuilder builder = newAuthenticationBuilder(TestUtils.getPrincipal());
    this.populator.populateAttributes(builder, credentials);
    final Authentication auth = builder.build();

    assertEquals(
            "FF",
            auth.getAttributes().get(SamlAuthenticationMetaDataPopulator.ATTRIBUTE_AUTHENTICATION_METHOD));
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:18,代码来源:SamlAuthenticationMetaDataPopulatorTests.java

示例4: MockTicketGrantingTicket

import org.jasig.cas.authentication.AuthenticationBuilder; //导入依赖的package包/类
public MockTicketGrantingTicket(final String id, final Credential credential) {
    this.id = id;
    final CredentialMetaData credentialMetaData = new BasicCredentialMetaData(credential);
    final AuthenticationBuilder builder = new AuthenticationBuilder();
    final Map<String, Object> attributes = new HashMap<String, Object>();
    attributes.put("nickname", "bob");
    builder.setPrincipal(new SimplePrincipal("handymanbob", attributes));
    builder.setAuthenticationDate(new Date());
    builder.addCredential(credentialMetaData);
    final AuthenticationHandler handler = new MockAuthenticationHandler();
    try {
        builder.addSuccess(handler.getName(), handler.authenticate(credential));
    } catch (final Exception e) {
        throw new RuntimeException(e);
    }
    builder.addFailure(handler.getName(), FailedLoginException.class);
    this.authentication = builder.build();
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:19,代码来源:KryoTranscoderTests.java

示例5: MockTicketGrantingTicket

import org.jasig.cas.authentication.AuthenticationBuilder; //导入依赖的package包/类
MockTicketGrantingTicket(final String id, final Credential credential, final Map<String, Object> principalAttributes) {
    this.id = id;
    final CredentialMetaData credentialMetaData = new BasicCredentialMetaData(credential);
    final AuthenticationBuilder builder = new DefaultAuthenticationBuilder();
    builder.setPrincipal(this.principalFactory.createPrincipal(USERNAME, principalAttributes));
    builder.setAuthenticationDate(new DateTime());
    builder.addCredential(credentialMetaData);
    builder.addAttribute(RememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME, Boolean.TRUE);
    final AuthenticationHandler handler = new MockAuthenticationHandler();
    try {
        builder.addSuccess(handler.getName(), handler.authenticate(credential));
    } catch (final Exception e) {
        throw new RuntimeException(e);
    }
    builder.addFailure(handler.getName(), FailedLoginException.class);
    this.authentication = builder.build();
}
 
开发者ID:yuweijun,项目名称:cas-server-4.2.1,代码行数:18,代码来源:KryoTranscoderTests.java

示例6: populateAttributes

import org.jasig.cas.authentication.AuthenticationBuilder; //导入依赖的package包/类
@Override
public void populateAttributes(final AuthenticationBuilder authenticationBuilder, final Credential credential) {
    final RequestContext context = RequestContextHolder.getRequestContext();
    if (context != null) {
        final Service svc = WebUtils.getService(context);

        if (svc instanceof MultiFactorAuthenticationSupportingWebApplicationService) {
            final MultiFactorAuthenticationSupportingWebApplicationService mfaSvc =
                    (MultiFactorAuthenticationSupportingWebApplicationService) svc;

            authenticationBuilder.addAttribute(
                    MultiFactorAuthenticationSupportingWebApplicationService.CONST_PARAM_AUTHN_METHOD,
                    mfaSvc.getAuthenticationMethod());

            logger.debug("Captured authentication method [{}] into the authentication context",
                    mfaSvc.getAuthenticationMethod());
        }
    }
}
 
开发者ID:Unicon,项目名称:cas-mfa,代码行数:20,代码来源:RememberAuthenticationMethodMetaDataPopulator.java

示例7: populateAttributes

import org.jasig.cas.authentication.AuthenticationBuilder; //导入依赖的package包/类
@Override
public void populateAttributes(final AuthenticationBuilder builder, final Credential credential) {
    final RememberMeCredential r = (RememberMeCredential) credential;
    if (r.isRememberMe()) {
        LOGGER.debug("Credential is configured to be remembered. Captured this as {} attribute",
                RememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME);
        builder.addAttribute(RememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME, Boolean.TRUE);
    }
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:10,代码来源:RememberMeAuthenticationMetaDataPopulator.java

示例8: verifyWithTrueRememberMeCredentials

import org.jasig.cas.authentication.AuthenticationBuilder; //导入依赖的package包/类
@Test
public void verifyWithTrueRememberMeCredentials() {
    final RememberMeUsernamePasswordCredential c = new RememberMeUsernamePasswordCredential();
    c.setRememberMe(true);
    final AuthenticationBuilder builder = newBuilder(c);
    final Authentication auth = builder.build();

    assertEquals(true, auth.getAttributes().get(RememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME));
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:10,代码来源:RememberMeAuthenticationMetaDataPopulatorTests.java

示例9: verifyWithFalseRememberMeCredentials

import org.jasig.cas.authentication.AuthenticationBuilder; //导入依赖的package包/类
@Test
public void verifyWithFalseRememberMeCredentials() {
    final RememberMeUsernamePasswordCredential c = new RememberMeUsernamePasswordCredential();
    c.setRememberMe(false);
    final AuthenticationBuilder builder = newBuilder(c);
    final Authentication auth = builder.build();

    assertNull(auth.getAttributes().get(RememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME));
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:10,代码来源:RememberMeAuthenticationMetaDataPopulatorTests.java

示例10: verifyWithoutRememberMeCredentials

import org.jasig.cas.authentication.AuthenticationBuilder; //导入依赖的package包/类
@Test
public void verifyWithoutRememberMeCredentials() {
    final AuthenticationBuilder builder = newBuilder(TestUtils.getCredentialsWithSameUsernameAndPassword());
    final Authentication auth = builder.build();

    assertNull(auth.getAttributes().get(RememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME));
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:8,代码来源:RememberMeAuthenticationMetaDataPopulatorTests.java

示例11: newBuilder

import org.jasig.cas.authentication.AuthenticationBuilder; //导入依赖的package包/类
private AuthenticationBuilder newBuilder(final Credential credential) {
    final CredentialMetaData meta = new BasicCredentialMetaData(new UsernamePasswordCredential());
    final AuthenticationHandler handler = new SimpleTestUsernamePasswordAuthenticationHandler();
    final AuthenticationBuilder builder = new DefaultAuthenticationBuilder(TestUtils.getPrincipal())
            .addCredential(meta)
            .addSuccess("test", new DefaultHandlerResult(handler, meta));

    if (this.p.supports(credential)) {
        this.p.populateAttributes(builder, credential);
    }
    return builder;
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:13,代码来源:RememberMeAuthenticationMetaDataPopulatorTests.java

示例12: populateAttributes

import org.jasig.cas.authentication.AuthenticationBuilder; //导入依赖的package包/类
@Override
public final void populateAttributes(final AuthenticationBuilder builder, final Credential credential) {

    final String credentialsClass = credential.getClass().getName();
    final String authenticationMethod = this.authenticationMethods.get(credentialsClass);

    builder.addAttribute(ATTRIBUTE_AUTHENTICATION_METHOD, authenticationMethod);
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:9,代码来源:SamlAuthenticationMetaDataPopulator.java

示例13: verifyAuthenticationTypeFound

import org.jasig.cas.authentication.AuthenticationBuilder; //导入依赖的package包/类
@Test
public void verifyAuthenticationTypeFound() {
    final UsernamePasswordCredential credentials = new UsernamePasswordCredential();
    final AuthenticationBuilder builder = newAuthenticationBuilder(
            org.jasig.cas.authentication.TestUtils.getPrincipal());
    this.populator.populateAttributes(builder, credentials);
    final Authentication auth = builder.build();

    assertEquals(
            auth.getAttributes().get(SamlAuthenticationMetaDataPopulator.ATTRIBUTE_AUTHENTICATION_METHOD),
            SamlAuthenticationMetaDataPopulator.AUTHN_METHOD_PASSWORD);
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:13,代码来源:SamlAuthenticationMetaDataPopulatorTests.java

示例14: verifyAuthenticationTypeNotFound

import org.jasig.cas.authentication.AuthenticationBuilder; //导入依赖的package包/类
@Test
public void verifyAuthenticationTypeNotFound() {
    final CustomCredential credentials = new CustomCredential();
    final AuthenticationBuilder builder = newAuthenticationBuilder(
            org.jasig.cas.authentication.TestUtils.getPrincipal());
    this.populator.populateAttributes(builder, credentials);
    final Authentication auth = builder.build();

    assertNull(auth.getAttributes().get(SamlAuthenticationMetaDataPopulator.ATTRIBUTE_AUTHENTICATION_METHOD));
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:11,代码来源:SamlAuthenticationMetaDataPopulatorTests.java

示例15: newAuthenticationBuilder

import org.jasig.cas.authentication.AuthenticationBuilder; //导入依赖的package包/类
private static AuthenticationBuilder newAuthenticationBuilder(final Principal principal) {
    final CredentialMetaData meta = new BasicCredentialMetaData(new UsernamePasswordCredential());
    final AuthenticationHandler handler = new SimpleTestUsernamePasswordAuthenticationHandler();
    return new DefaultAuthenticationBuilder(principal)
            .addCredential(meta)
            .addSuccess("test", new DefaultHandlerResult(handler, meta));
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:8,代码来源:SamlAuthenticationMetaDataPopulatorTests.java


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