本文整理汇总了Java中org.jasig.cas.ticket.TicketGrantingTicket.isExpired方法的典型用法代码示例。如果您正苦于以下问题:Java TicketGrantingTicket.isExpired方法的具体用法?Java TicketGrantingTicket.isExpired怎么用?Java TicketGrantingTicket.isExpired使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jasig.cas.ticket.TicketGrantingTicket
的用法示例。
在下文中一共展示了TicketGrantingTicket.isExpired方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: authenticate
import org.jasig.cas.ticket.TicketGrantingTicket; //导入方法依赖的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: authenticate
import org.jasig.cas.ticket.TicketGrantingTicket; //导入方法依赖的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);
}
示例3: verifyAccessToken
import org.jasig.cas.ticket.TicketGrantingTicket; //导入方法依赖的package包/类
private TicketGrantingTicket verifyAccessToken(final String accessToken, final JsonGenerator jsonGenerator) throws IOException {
final TicketGrantingTicket ticketGrantingTicket = (TicketGrantingTicket) this.ticketRegistry.getTicket(accessToken);
if (ticketGrantingTicket == null || ticketGrantingTicket.isExpired()) {
LOGGER.error("expired accessToken : {}", accessToken);
jsonGenerator.writeStartObject();
jsonGenerator.writeStringField("error", OAuthConstants.INVALID_REQUEST);
jsonGenerator.writeEndObject();
return null;
}
return ticketGrantingTicket;
}
示例4: isExpired
import org.jasig.cas.ticket.TicketGrantingTicket; //导入方法依赖的package包/类
@Override
public final boolean isExpired() {
if (!callback) {
return this.ticket.isExpired();
}
final TicketGrantingTicket t = getGrantingTicket();
return this.ticket.isExpired() || (t != null && t.isExpired());
}
示例5: isExpired
import org.jasig.cas.ticket.TicketGrantingTicket; //导入方法依赖的package包/类
public final boolean isExpired() {
if (!callback) {
return this.ticket.isExpired();
}
final TicketGrantingTicket t = getGrantingTicket();
return this.ticket.isExpired() || (t != null && t.isExpired());
}
示例6: handleRequestInternal
import org.jasig.cas.ticket.TicketGrantingTicket; //导入方法依赖的package包/类
@Override
protected ModelAndView handleRequestInternal(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
String accessToken = request.getParameter(OAuthConstants.ACCESS_TOKEN);
if (StringUtils.isBlank(accessToken)) {
final String authHeader = request.getHeader("Authorization");
if (StringUtils.isNotBlank(authHeader)
&& authHeader.toLowerCase().startsWith(OAuthConstants.BEARER_TOKEN.toLowerCase() + ' ')) {
accessToken = authHeader.substring(OAuthConstants.BEARER_TOKEN.length() + 1);
}
}
LOGGER.debug("{} : {}", OAuthConstants.ACCESS_TOKEN, accessToken);
try (final JsonGenerator jsonGenerator = this.jsonFactory.createJsonGenerator(response.getWriter())) {
response.setContentType("application/json");
// accessToken is required
if (StringUtils.isBlank(accessToken)) {
LOGGER.error("Missing {}", OAuthConstants.ACCESS_TOKEN);
jsonGenerator.writeStartObject();
jsonGenerator.writeStringField("error", OAuthConstants.MISSING_ACCESS_TOKEN);
jsonGenerator.writeEndObject();
return null;
}
// get ticket granting ticket
final TicketGrantingTicket ticketGrantingTicket = (TicketGrantingTicket) this.ticketRegistry.getTicket(accessToken);
if (ticketGrantingTicket == null || ticketGrantingTicket.isExpired()) {
LOGGER.error("expired accessToken : {}", accessToken);
jsonGenerator.writeStartObject();
jsonGenerator.writeStringField("error", OAuthConstants.EXPIRED_ACCESS_TOKEN);
jsonGenerator.writeEndObject();
return null;
}
// generate profile : identifier + attributes
final Principal principal = ticketGrantingTicket.getAuthentication().getPrincipal();
jsonGenerator.writeStartObject();
jsonGenerator.writeStringField(ID, principal.getId());
jsonGenerator.writeArrayFieldStart(ATTRIBUTES);
final Map<String, Object> attributes = principal.getAttributes();
for (final Map.Entry<String, Object> entry : attributes.entrySet()) {
jsonGenerator.writeStartObject();
jsonGenerator.writeObjectField(entry.getKey(), entry.getValue());
jsonGenerator.writeEndObject();
}
jsonGenerator.writeEndArray();
jsonGenerator.writeEndObject();
return null;
} finally {
response.flushBuffer();
}
}
示例7: handleRequestInternal
import org.jasig.cas.ticket.TicketGrantingTicket; //导入方法依赖的package包/类
@Override
protected ModelAndView handleRequestInternal(final HttpServletRequest request, final HttpServletResponse response)
throws Exception {
final String accessToken = request.getParameter(OAuthConstants.ACCESS_TOKEN);
LOGGER.debug("{} : {}", OAuthConstants.ACCESS_TOKEN, accessToken);
final JsonGenerator jsonGenerator = this.jsonFactory.createJsonGenerator(response.getWriter());
try {
response.setContentType("application/json");
// accessToken is required
if (StringUtils.isBlank(accessToken)) {
LOGGER.error("Missing {}", OAuthConstants.ACCESS_TOKEN);
jsonGenerator.writeStartObject();
jsonGenerator.writeStringField("error", OAuthConstants.MISSING_ACCESS_TOKEN);
jsonGenerator.writeEndObject();
return null;
}
// get ticket granting ticket
final TicketGrantingTicket ticketGrantingTicket = (TicketGrantingTicket) this.ticketRegistry
.getTicket(accessToken);
if (ticketGrantingTicket == null || ticketGrantingTicket.isExpired()) {
LOGGER.error("expired accessToken : {}", accessToken);
jsonGenerator.writeStartObject();
jsonGenerator.writeStringField("error", OAuthConstants.EXPIRED_ACCESS_TOKEN);
jsonGenerator.writeEndObject();
return null;
}
// generate profile : identifier + attributes
final Principal principal = ticketGrantingTicket.getAuthentication().getPrincipal();
jsonGenerator.writeStartObject();
jsonGenerator.writeStringField(ID, principal.getId());
jsonGenerator.writeArrayFieldStart(ATTRIBUTES);
final Map<String, Object> attributes = principal.getAttributes();
for (final String key : attributes.keySet()) {
jsonGenerator.writeStartObject();
jsonGenerator.writeObjectField(key, attributes.get(key));
jsonGenerator.writeEndObject();
}
jsonGenerator.writeEndArray();
jsonGenerator.writeEndObject();
return null;
} finally {
IOUtils.closeQuietly(jsonGenerator);
response.flushBuffer();
}
}