gpt4 book ai didi

org.apache.wss4j.common.principal.WSUsernameTokenPrincipalImpl.setCreatedTime()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-22 16:05:05 26 4
gpt4 key购买 nike

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

WSUsernameTokenPrincipalImpl.setCreatedTime介绍

[英]Set the WSUsernameToken created time for this WSUsernameTokenPrincipalImpl.
[中]设置此[$0$]的WSUsernameToken创建时间。

代码示例

代码示例来源:origin: apache/cxf

/**
 * Create a principal based on the authenticated UsernameToken.
 * @throws Base64DecodingException
 */
private Principal createPrincipal(
  String username,
  String passwordValue,
  String passwordType,
  String nonce,
  String createdTime
) {
  boolean hashed = false;
  if (WSS4JConstants.PASSWORD_DIGEST.equals(passwordType)) {
    hashed = true;
  }
  WSUsernameTokenPrincipalImpl principal = new WSUsernameTokenPrincipalImpl(username, hashed);
  if (nonce != null) {
    principal.setNonce(Base64.getMimeDecoder().decode(nonce));
  }
  principal.setPassword(passwordValue);
  principal.setCreatedTime(createdTime);
  principal.setPasswordType(passwordType);
  return principal;
}

代码示例来源:origin: org.apache.cxf.services.sts/cxf-services-sts-core

/**
 * Create a principal based on the authenticated UsernameToken.
 * @throws Base64DecodingException
 */
private Principal createPrincipal(
  String username,
  String passwordValue,
  String passwordType,
  String nonce,
  String createdTime
) {
  boolean hashed = false;
  if (WSS4JConstants.PASSWORD_DIGEST.equals(passwordType)) {
    hashed = true;
  }
  WSUsernameTokenPrincipalImpl principal = new WSUsernameTokenPrincipalImpl(username, hashed);
  if (nonce != null) {
    principal.setNonce(Base64.getMimeDecoder().decode(nonce));
  }
  principal.setPassword(passwordValue);
  principal.setCreatedTime(createdTime);
  principal.setPasswordType(passwordType);
  return principal;
}

代码示例来源:origin: org.apache.wss4j/wss4j-ws-security-dom

/**
 * Create a WSUsernameTokenPrincipal from this UsernameToken object
 */
public Principal createPrincipal() throws WSSecurityException {
  WSUsernameTokenPrincipalImpl principal =
    new WSUsernameTokenPrincipalImpl(getName(), isHashed());
  String nonce = getNonce();
  if (nonce != null) {
    principal.setNonce(org.apache.xml.security.utils.XMLUtils.decode(nonce));
  }
  principal.setPassword(getPassword());
  principal.setCreatedTime(getCreated());
  return principal;
}

代码示例来源:origin: apache/cxf

public Credential validate(Credential credential, RequestData data) throws WSSecurityException {
    Credential cred = super.validate(credential, data);

    UsernameToken ut = credential.getUsernametoken();
    WSUsernameTokenPrincipalImpl principal =
      new WSUsernameTokenPrincipalImpl(ut.getName(), ut.isHashed());
    principal.setCreatedTime(ut.getCreated());
    principal.setNonce(principal.getNonce());
    principal.setPassword(ut.getPassword());
    principal.setPasswordType(ut.getPasswordType());

    Subject subject = new Subject();
    subject.getPrincipals().add(principal);
    if ("Alice".equals(ut.getName())) {
      subject.getPrincipals().add(new SimpleGroup("manager", ut.getName()));
    }
    subject.getPrincipals().add(new SimpleGroup("worker", ut.getName()));
    cred.setSubject(subject);

    return cred;
  }
}

代码示例来源:origin: apache/cxf

protected UsernameTokenPrincipal parseTokenAndCreatePrincipal(Element tokenElement, boolean bspCompliant)
  throws WSSecurityException, Base64DecodingException {
  BSPEnforcer bspEnforcer = new org.apache.wss4j.common.bsp.BSPEnforcer(!bspCompliant);
  org.apache.wss4j.dom.message.token.UsernameToken ut =
    new org.apache.wss4j.dom.message.token.UsernameToken(tokenElement, false, bspEnforcer);
  WSUsernameTokenPrincipalImpl principal = new WSUsernameTokenPrincipalImpl(ut.getName(), ut.isHashed());
  if (ut.getNonce() != null) {
    principal.setNonce(XMLUtils.decode(ut.getNonce()));
  }
  principal.setPassword(ut.getPassword());
  principal.setCreatedTime(ut.getCreated());
  principal.setPasswordType(ut.getPasswordType());
  return principal;
}

代码示例来源:origin: org.apache.cxf/cxf-rt-ws-security

protected UsernameTokenPrincipal parseTokenAndCreatePrincipal(Element tokenElement, boolean bspCompliant)
  throws WSSecurityException, Base64DecodingException {
  BSPEnforcer bspEnforcer = new org.apache.wss4j.common.bsp.BSPEnforcer(!bspCompliant);
  org.apache.wss4j.dom.message.token.UsernameToken ut =
    new org.apache.wss4j.dom.message.token.UsernameToken(tokenElement, false, bspEnforcer);
  WSUsernameTokenPrincipalImpl principal = new WSUsernameTokenPrincipalImpl(ut.getName(), ut.isHashed());
  if (ut.getNonce() != null) {
    principal.setNonce(XMLUtils.decode(ut.getNonce()));
  }
  principal.setPassword(ut.getPassword());
  principal.setCreatedTime(ut.getCreated());
  principal.setPasswordType(ut.getPasswordType());
  return principal;
}

代码示例来源:origin: org.apache.wss4j/wss4j-ws-security-dom

principal.setCreatedTime(token.getCreated());
principal.setPasswordType(token.getPasswordType());
result.put(WSSecurityEngineResult.TAG_PRINCIPAL, principal);

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com