本文整理汇总了Java中org.jasig.cas.support.openid.authentication.principal.OpenIdCredential类的典型用法代码示例。如果您正苦于以下问题:Java OpenIdCredential类的具体用法?Java OpenIdCredential怎么用?Java OpenIdCredential使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OpenIdCredential类属于org.jasig.cas.support.openid.authentication.principal包,在下文中一共展示了OpenIdCredential类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: authenticate
import org.jasig.cas.support.openid.authentication.principal.OpenIdCredential; //导入依赖的package包/类
@Override
public HandlerResult authenticate(final Credential credential) throws GeneralSecurityException {
final OpenIdCredential c = (OpenIdCredential) credential;
final TicketGrantingTicket t = this.ticketRegistry.getTicket(c.getTicketGrantingTicketId(),
TicketGrantingTicket.class);
if (t == null || t.isExpired()) {
throw new FailedLoginException("TGT is null or expired.");
}
final Principal principal = t.getAuthentication().getPrincipal();
if (!principal.getId().equals(c.getUsername())) {
throw new FailedLoginException("Principal ID mismatch");
}
return new DefaultHandlerResult(this, new BasicCredentialMetaData(c), principal);
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:17,代码来源:OpenIdCredentialsAuthenticationHandler.java
示例2: constructCredentialsFromRequest
import org.jasig.cas.support.openid.authentication.principal.OpenIdCredential; //导入依赖的package包/类
@Override
protected Credential constructCredentialsFromRequest(final RequestContext context) {
final String ticketGrantingTicketId = WebUtils.getTicketGrantingTicketId(context);
final String userName = this.extractor
.extractLocalUsernameFromUri(context.getRequestParameters()
.get("openid.identity"));
final Service service = WebUtils.getService(context);
context.getExternalContext().getSessionMap().put("openIdLocalId", userName);
// clear the service because otherwise we can fake the username
if (service instanceof OpenIdService && userName == null) {
context.getFlowScope().remove("service");
}
if (ticketGrantingTicketId == null || userName == null) {
return null;
}
return new OpenIdCredential(
ticketGrantingTicketId, userName);
}
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:23,代码来源:OpenIdSingleSignOnAction.java
示例3: authenticate
import org.jasig.cas.support.openid.authentication.principal.OpenIdCredential; //导入依赖的package包/类
@Override
public HandlerResult authenticate(final Credential credential) throws GeneralSecurityException {
final OpenIdCredential c = (OpenIdCredential) credential;
final TicketGrantingTicket t = this.ticketRegistry.getTicket(c.getTicketGrantingTicketId(),
TicketGrantingTicket.class);
if (t == null || t.isExpired()) {
throw new FailedLoginException("TGT is null or expired.");
}
final Principal principal = t.getAuthentication().getPrincipal();
if (!principal.getId().equals(c.getUsername())) {
throw new FailedLoginException("Principal ID mismatch");
}
return new HandlerResult(this, new BasicCredentialMetaData(c), principal);
}
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:17,代码来源:OpenIdCredentialsAuthenticationHandler.java
示例4: constructCredentialsFromRequest
import org.jasig.cas.support.openid.authentication.principal.OpenIdCredential; //导入依赖的package包/类
@Override
protected Credential constructCredentialsFromRequest(final RequestContext context) {
final String ticketGrantingTicketId = WebUtils.getTicketGrantingTicketId(context);
final String openidIdentityParameter = context.getRequestParameters().get(OpenIdProtocolConstants.OPENID_IDENTITY);
String userName = null;
if (OpenIdProtocolConstants.OPENID_IDENTIFIERSELECT.equals(openidIdentityParameter)) {
userName = OpenIdProtocolConstants.OPENID_IDENTIFIERSELECT;
context.getExternalContext().getSessionMap().remove(OpenIdProtocolConstants.OPENID_LOCALID);
// already authenticated: retrieve the username from the authentication
if (ticketGrantingTicketId != null) {
try {
final TicketGrantingTicket tgt = getCentralAuthenticationService()
.getTicket(ticketGrantingTicketId, TicketGrantingTicket.class);
userName = tgt.getAuthentication().getPrincipal().getId();
} catch (final InvalidTicketException e) {
logger.error("Cannot get TGT", e);
}
}
} else {
userName = this.extractor.extractLocalUsernameFromUri(openidIdentityParameter);
context.getExternalContext().getSessionMap().put(OpenIdProtocolConstants.OPENID_LOCALID, userName);
}
final Service service = WebUtils.getService(context);
// clear the service because otherwise we can fake the username
if (service instanceof OpenIdService && userName == null) {
context.getFlowScope().remove("service");
}
if (ticketGrantingTicketId == null || userName == null) {
return null;
}
return new OpenIdCredential(
ticketGrantingTicketId, userName);
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:37,代码来源:OpenIdSingleSignOnAction.java
示例5: verifyTGTWithSameId
import org.jasig.cas.support.openid.authentication.principal.OpenIdCredential; //导入依赖的package包/类
@Test
public void verifyTGTWithSameId() throws Exception {
final OpenIdCredential c = new OpenIdCredential("test", "test");
final TicketGrantingTicket t = getTicketGrantingTicket();
this.ticketRegistry.addTicket(t);
assertEquals("test", this.openIdCredentialsAuthenticationHandler.authenticate(c).getPrincipal().getId());
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:9,代码来源:OpenIdCredentialsAuthenticationHandlerTests.java
示例6: verifyTGTThatIsExpired
import org.jasig.cas.support.openid.authentication.principal.OpenIdCredential; //导入依赖的package包/类
@Test(expected = FailedLoginException.class)
public void verifyTGTThatIsExpired() throws Exception {
final OpenIdCredential c = new OpenIdCredential("test", "test");
final TicketGrantingTicket t = getTicketGrantingTicket();
this.ticketRegistry.addTicket(t);
t.markTicketExpired();
this.openIdCredentialsAuthenticationHandler.authenticate(c);
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:10,代码来源:OpenIdCredentialsAuthenticationHandlerTests.java
示例7: verifyTGTWithDifferentId
import org.jasig.cas.support.openid.authentication.principal.OpenIdCredential; //导入依赖的package包/类
@Test(expected = FailedLoginException.class)
public void verifyTGTWithDifferentId() throws Exception {
final OpenIdCredential c = new OpenIdCredential("test", "test1");
final TicketGrantingTicket t = getTicketGrantingTicket();
this.ticketRegistry.addTicket(t);
this.openIdCredentialsAuthenticationHandler.authenticate(c);
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:9,代码来源:OpenIdCredentialsAuthenticationHandlerTests.java
示例8: constructCredentialsFromRequest
import org.jasig.cas.support.openid.authentication.principal.OpenIdCredential; //导入依赖的package包/类
@Override
protected Credential constructCredentialsFromRequest(final RequestContext context) {
final String ticketGrantingTicketId = WebUtils.getTicketGrantingTicketId(context);
final String openidIdentityParameter = context.getRequestParameters().get(OpenIdConstants.OPENID_IDENTITY);
String userName = null;
if (OpenIdConstants.OPENID_IDENTIFIERSELECT.equals(openidIdentityParameter)) {
userName = OpenIdConstants.OPENID_IDENTIFIERSELECT;
context.getExternalContext().getSessionMap().remove(OpenIdConstants.OPENID_LOCALID);
// already authenticated: retrieve the username from the authentication
if (ticketGrantingTicketId != null) {
try {
final TicketGrantingTicket tgt = getCentralAuthenticationService()
.getTicket(ticketGrantingTicketId, TicketGrantingTicket.class);
userName = tgt.getAuthentication().getPrincipal().getId();
} catch (final InvalidTicketException e) {
logger.error("Cannot get TGT", e);
}
}
} else {
userName = this.extractor.extractLocalUsernameFromUri(openidIdentityParameter);
context.getExternalContext().getSessionMap().put(OpenIdConstants.OPENID_LOCALID, userName);
}
final Service service = WebUtils.getService(context);
// clear the service because otherwise we can fake the username
if (service instanceof OpenIdService && userName == null) {
context.getFlowScope().remove("service");
}
if (ticketGrantingTicketId == null || userName == null) {
return null;
}
return new OpenIdCredential(
ticketGrantingTicketId, userName);
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:37,代码来源:OpenIdSingleSignOnAction.java
示例9: testTGTWithSameId
import org.jasig.cas.support.openid.authentication.principal.OpenIdCredential; //导入依赖的package包/类
@Test
public void testTGTWithSameId() throws Exception {
final OpenIdCredential c = new OpenIdCredential("test", "test");
final TicketGrantingTicket t = getTicketGrantingTicket();
this.ticketRegistry.addTicket(t);
assertEquals("test", this.openIdCredentialsAuthenticationHandler.authenticate(c).getPrincipal().getId());
}
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:9,代码来源:OpenIdCredentialsAuthenticationHandlerTests.java
示例10: testTGTThatIsExpired
import org.jasig.cas.support.openid.authentication.principal.OpenIdCredential; //导入依赖的package包/类
@Test(expected = FailedLoginException.class)
public void testTGTThatIsExpired() throws Exception {
final OpenIdCredential c = new OpenIdCredential("test", "test");
final TicketGrantingTicket t = getTicketGrantingTicket();
this.ticketRegistry.addTicket(t);
t.markTicketExpired();
this.openIdCredentialsAuthenticationHandler.authenticate(c);
}
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:10,代码来源:OpenIdCredentialsAuthenticationHandlerTests.java
示例11: testTGTWithDifferentId
import org.jasig.cas.support.openid.authentication.principal.OpenIdCredential; //导入依赖的package包/类
@Test(expected = FailedLoginException.class)
public void testTGTWithDifferentId() throws Exception {
final OpenIdCredential c = new OpenIdCredential("test", "test1");
final TicketGrantingTicket t = getTicketGrantingTicket();
this.ticketRegistry.addTicket(t);
this.openIdCredentialsAuthenticationHandler.authenticate(c);
}
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:9,代码来源:OpenIdCredentialsAuthenticationHandlerTests.java
注:本文中的org.jasig.cas.support.openid.authentication.principal.OpenIdCredential类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论