org.acegisecurity.Authentication.getDetails()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(252)

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

Authentication.getDetails介绍

[英]Stores additional details about the authentication request. These might be an IP address, certificate serial number etc.
[中]存储有关身份验证请求的其他详细信息。这些可能是IP地址、证书序列号等。

代码示例

代码示例来源:origin: jenkinsci/jenkins

@Exported
public String getDetails() {
  return auth().getDetails() != null ? auth().getDetails().toString() : null;
}

代码示例来源:origin: org.mule.modules/mule-module-acegi

public Object getDetails()
{
  return delegate.getDetails();
}

代码示例来源:origin: org.acegisecurity/acegi-security

public static String obtainSessionIdFromAuthentication(Authentication auth) {
    Assert.notNull(auth, "Authentication required");
    Assert.notNull(auth.getDetails(), "Authentication.getDetails() required");
    Assert.isInstanceOf(SessionIdentifierAware.class, auth.getDetails());

    String sessionId = ((SessionIdentifierAware) auth.getDetails()).getSessionId();
    Assert.hasText(sessionId, "SessionIdentifierAware did not return a Session ID (" + auth.getDetails() + ")");

    return sessionId;
  }
}

代码示例来源:origin: org.acegisecurity/acegi-security

/**
 * Copies the authentication details from a source Authentication object to a destination one, provided the
 * latter does not already have one set.
 *
 * @param source source authentication
 * @param dest the destination authentication object
 */
private void copyDetails(Authentication source, Authentication dest) {
  if ((dest instanceof AbstractAuthenticationToken) && (dest.getDetails() == null)) {
    AbstractAuthenticationToken token = (AbstractAuthenticationToken) dest;
    token.setDetails(source.getDetails());
  }
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

@Exported
public String getDetails() {
  return auth().getDetails() != null ? auth().getDetails().toString() : null;
}

代码示例来源:origin: org.acegisecurity/acegi-security

public void onApplicationEvent(ApplicationEvent event) {
  if (event instanceof AbstractAuthenticationEvent) {
    AbstractAuthenticationEvent authEvent = (AbstractAuthenticationEvent) event;
    
    if (!logInteractiveAuthenticationSuccessEvents && authEvent instanceof InteractiveAuthenticationSuccessEvent) {
      return;
    }
    if (logger.isWarnEnabled()) {
      String message = "Authentication event " + ClassUtils.getShortName(authEvent.getClass()) + ": "
        + authEvent.getAuthentication().getName() + "; details: "
        + authEvent.getAuthentication().getDetails();
      if (event instanceof AbstractAuthenticationFailureEvent) {
        message = message + "; exception: "
          + ((AbstractAuthenticationFailureEvent) event).getException().getMessage();
      }
      logger.warn(message);
    }
  }
}

代码示例来源:origin: org.acegisecurity/acegi-security

/**
 * Creates a successful {@link Authentication} object.<p>Protected so subclasses can override.</p>
 *  <p>Subclasses will usually store the original credentials the user supplied (not salted or encoded
 * passwords) in the returned <code>Authentication</code> object.</p>
 *
 * @param principal that should be the principal in the returned object (defined by the {@link
 *        #isForcePrincipalAsString()} method)
 * @param authentication that was presented to the provider for validation
 * @param user that was loaded by the implementation
 *
 * @return the successful authentication token
 */
protected Authentication createSuccessAuthentication(Object principal, Authentication authentication,
  UserDetails user) {
  // Ensure we return the original credentials the user supplied,
  // so subsequent attempts are successful even with encoded passwords.
  // Also ensure we return the original getDetails(), so that future
  // authentication events after cache expiry contain the details
  UsernamePasswordAuthenticationToken result = new UsernamePasswordAuthenticationToken(principal,
      authentication.getCredentials(), user.getAuthorities());
  result.setDetails(authentication.getDetails());
  return result;
}

代码示例来源:origin: org.acegisecurity/acegi-security

result.setDetails(authentication.getDetails());

代码示例来源:origin: org.acegisecurity/acegi-security

result.setDetails(authentication.getDetails());

相关文章