本文整理汇总了Java中org.jasig.cas.authentication.AuthenticationBuilder.build方法的典型用法代码示例。如果您正苦于以下问题:Java AuthenticationBuilder.build方法的具体用法?Java AuthenticationBuilder.build怎么用?Java AuthenticationBuilder.build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jasig.cas.authentication.AuthenticationBuilder
的用法示例。
在下文中一共展示了AuthenticationBuilder.build方法的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(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
示例2: 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();
}
示例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));
}
示例4: 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
示例5: 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
示例6: 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
示例7: 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
示例8: 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));
}
示例9: testWithoutRememberMeCredentials
import org.jasig.cas.authentication.AuthenticationBuilder; //导入方法依赖的package包/类
@Test
public void testWithoutRememberMeCredentials() {
final AuthenticationBuilder builder = newBuilder(TestUtils.getCredentialsWithSameUsernameAndPassword());
final Authentication auth = builder.build();
assertNull(auth.getAttributes().get(RememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME));
}
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:8,代码来源:RememberMeAuthenticationMetaDataPopulatorTests.java
示例10: testWithFalseRememberMeCredentials
import org.jasig.cas.authentication.AuthenticationBuilder; //导入方法依赖的package包/类
@Test
public void testWithFalseRememberMeCredentials() {
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:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:10,代码来源:RememberMeAuthenticationMetaDataPopulatorTests.java
示例11: verifyAuthenticationTypeNotFound
import org.jasig.cas.authentication.AuthenticationBuilder; //导入方法依赖的package包/类
@Test
public void verifyAuthenticationTypeNotFound() {
final CustomCredential credentials = new CustomCredential();
final AuthenticationBuilder builder = newAuthenticationBuilder(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,代码行数:10,代码来源:SamlAuthenticationMetaDataPopulatorTests.java
示例12: verifyEncodeDecodeTGTImpl
import org.jasig.cas.authentication.AuthenticationBuilder; //导入方法依赖的package包/类
@Test
public void verifyEncodeDecodeTGTImpl() throws Exception {
final Credential userPassCredential = new UsernamePasswordCredential(USERNAME, PASSWORD);
final AuthenticationBuilder bldr = new DefaultAuthenticationBuilder(
new DefaultPrincipalFactory()
.createPrincipal("user", Collections.unmodifiableMap(this.principalAttributes)));
bldr.setAttributes(Collections.unmodifiableMap(this.principalAttributes));
bldr.setAuthenticationDate(new DateTime());
bldr.addCredential(new BasicCredentialMetaData(userPassCredential));
bldr.addFailure("error", AccountNotFoundException.class);
bldr.addSuccess("authn", new DefaultHandlerResult(
new AcceptUsersAuthenticationHandler(),
new BasicCredentialMetaData(userPassCredential)));
final TicketGrantingTicket expectedTGT =
new TicketGrantingTicketImpl(TGT_ID,
org.jasig.cas.services.TestUtils.getService(),
null, bldr.build(),
new NeverExpiresExpirationPolicy());
final ServiceTicket ticket = expectedTGT.grantServiceTicket(ST_ID,
org.jasig.cas.services.TestUtils.getService(),
new NeverExpiresExpirationPolicy(), false, true);
CachedData result = transcoder.encode(expectedTGT);
final TicketGrantingTicket resultTicket = (TicketGrantingTicket) transcoder.decode(result);
assertEquals(expectedTGT, resultTicket);
result = transcoder.encode(ticket);
final ServiceTicket resultStTicket = (ServiceTicket) transcoder.decode(result);
assertEquals(ticket, resultStTicket);
}
示例13: verifyEncodeDecodeTGTImpl
import org.jasig.cas.authentication.AuthenticationBuilder; //导入方法依赖的package包/类
@Test
public void verifyEncodeDecodeTGTImpl() throws Exception {
final Credential userPassCredential = new UsernamePasswordCredential(USERNAME, PASSWORD);
final AuthenticationBuilder bldr = new DefaultAuthenticationBuilder(
new DefaultPrincipalFactory()
.createPrincipal("user", Collections.unmodifiableMap(this.principalAttributes)));
bldr.setAttributes(Collections.unmodifiableMap(this.principalAttributes));
bldr.setAuthenticationDate(new Date());
bldr.addCredential(new BasicCredentialMetaData(userPassCredential));
bldr.addFailure("error", AccountNotFoundException.class);
bldr.addSuccess("authn", new DefaultHandlerResult(
new AcceptUsersAuthenticationHandler(),
new BasicCredentialMetaData(userPassCredential)));
final TicketGrantingTicket parent =
new TicketGrantingTicketImpl(TGT_ID, TestUtils.getService(), null, bldr.build(),
new NeverExpiresExpirationPolicy());
final TicketGrantingTicket expectedTGT =
new TicketGrantingTicketImpl(TGT_ID, TestUtils.getService(),
null, bldr.build(),
new NeverExpiresExpirationPolicy());
final ServiceTicket ticket = expectedTGT.grantServiceTicket(ST_ID,
TestUtils.getService(),
new NeverExpiresExpirationPolicy(), false);
CachedData result = transcoder.encode(expectedTGT);
final TicketGrantingTicket resultTicket = (TicketGrantingTicket) transcoder.decode(result);
assertEquals(expectedTGT, resultTicket);
result = transcoder.encode(ticket);
final ServiceTicket resultStTicket = (ServiceTicket) transcoder.decode(result);
assertEquals(ticket, resultStTicket);
}
示例14: testAuthenticationTypeFound
import org.jasig.cas.authentication.AuthenticationBuilder; //导入方法依赖的package包/类
@Test
public void testAuthenticationTypeFound() {
final UsernamePasswordCredential credentials = new UsernamePasswordCredential();
final AuthenticationBuilder builder = newAuthenticationBuilder(TestUtils.getPrincipal());
this.populator.populateAttributes(builder, credentials);
final Authentication auth = builder.build();
assertEquals(
auth.getAttributes().get(SamlAuthenticationMetaDataPopulator.ATTRIBUTE_AUTHENTICATION_METHOD),
SamlAuthenticationMetaDataPopulator.AUTHN_METHOD_PASSWORD);
}
示例15: testAuthenticationTypeNotFound
import org.jasig.cas.authentication.AuthenticationBuilder; //导入方法依赖的package包/类
@Test
public void testAuthenticationTypeNotFound() {
final CustomCredential credentials = new CustomCredential();
final AuthenticationBuilder builder = newAuthenticationBuilder(TestUtils.getPrincipal());
this.populator.populateAttributes(builder, credentials);
final Authentication auth = builder.build();
assertNull(auth.getAttributes().get(SamlAuthenticationMetaDataPopulator.ATTRIBUTE_AUTHENTICATION_METHOD));
}