org.jasig.cas.authentication.Authentication.getAuthenticationDate()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(156)

本文整理了Java中org.jasig.cas.authentication.Authentication.getAuthenticationDate()方法的一些代码示例,展示了Authentication.getAuthenticationDate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Authentication.getAuthenticationDate()方法的具体详情如下:
包路径:org.jasig.cas.authentication.Authentication
类名称:Authentication
方法名:getAuthenticationDate

Authentication.getAuthenticationDate介绍

[英]Method to retrieve the timestamp of when this Authentication object was created.
[中]方法检索创建此身份验证对象时的时间戳。

代码示例

代码示例来源:origin: org.jasig.cas/cas-server-core-web

/**
 * Gets authentication date.
 *
 * @param model the model
 * @return the authentication date
 * @since 4.1.0
 */
protected final DateTime getAuthenticationDate(final Map<String, Object> model) {
  return getPrimaryAuthenticationFrom(model).getAuthenticationDate();
}

代码示例来源:origin: org.jasig.cas/cas-server-core-authentication

@Override
public boolean equals(final Object obj) {
  if (!(obj instanceof Authentication)) {
    return false;
  }
  if (obj == this) {
    return true;
  }
  final Authentication other = (Authentication) obj;
  final EqualsBuilder builder = new EqualsBuilder();
  builder.append(this.principal, other.getPrincipal());
  builder.append(this.credentials, other.getCredentials());
  builder.append(this.successes, other.getSuccesses());
  builder.append(this.authenticationDate, other.getAuthenticationDate());
  builder.append(wrap(this.attributes), other.getAttributes());
  builder.append(wrap(this.failures), other.getFailures());
  return builder.isEquals();
}

代码示例来源:origin: org.jasig.cas/cas-server-webapp-reports

sso.put(SsoSessionAttributeKeys.AUTHENTICATION_DATE.toString(), authentication.getAuthenticationDate());
sso.put(SsoSessionAttributeKeys.AUTHENTICATION_DATE_FORMATTED.toString(),
    dateFormat.format(authentication.getAuthenticationDate()));
sso.put(SsoSessionAttributeKeys.NUMBER_OF_USES.toString(), tgt.getCountOfUses());
sso.put(SsoSessionAttributeKeys.TICKET_GRANTING_TICKET.toString(), tgt.getId());

代码示例来源:origin: org.jasig.cas/cas-server-support-saml

@Override
protected void prepareResponse(final Response response, final Map<String, Object> model) {
  final DateTime issuedAt = response.getIssueInstant();
  final Service service = getAssertionFrom(model).getService();
  final Authentication authentication = getPrimaryAuthenticationFrom(model);
  final String authenticationMethod = (String) authentication.getAttributes().get(
      SamlAuthenticationMetaDataPopulator.ATTRIBUTE_AUTHENTICATION_METHOD);
  final AuthenticationStatement authnStatement = this.samlObjectBuilder.newAuthenticationStatement(
      authentication.getAuthenticationDate().toDate(), authenticationMethod, getPrincipal(model).getId());
  final Assertion assertion = this.samlObjectBuilder.newAssertion(authnStatement, this.issuer, issuedAt,
      this.samlObjectBuilder.generateSecureRandomId());
  final Conditions conditions = this.samlObjectBuilder.newConditions(issuedAt, service.getId(), this.issueLength);
  assertion.setConditions(conditions);
  final Subject subject = this.samlObjectBuilder.newSubject(getPrincipal(model).getId());
  final Map<String, Object> attributesToSend = prepareSamlAttributes(model, service);
  if (!attributesToSend.isEmpty()) {
    assertion.getAttributeStatements().add(this.samlObjectBuilder.newAttributeStatement(
        subject, attributesToSend, VALIDATION_SAML_ATTRIBUTE_NAMESPACE));
  }
  response.setStatus(this.samlObjectBuilder.newStatus(StatusCode.SUCCESS, null));
  response.getAssertions().add(assertion);
}

代码示例来源:origin: org.jasig.cas/cas-server-core-authentication

/**
 * Creates a new builder initialized with data from the given authentication source.
 *
 * @param source Authentication source.
 *
 * @return New builder instance initialized with all fields in the given authentication source.
 */
public static AuthenticationBuilder newInstance(final Authentication source) {
  final DefaultAuthenticationBuilder builder = new DefaultAuthenticationBuilder(source.getPrincipal());
  builder.setAuthenticationDate(source.getAuthenticationDate());
  builder.setCredentials(source.getCredentials());
  builder.setSuccesses(source.getSuccesses());
  builder.setFailures(source.getFailures());
  builder.setAttributes(source.getAttributes());
  return builder;
}

相关文章