コード例 #1
0
 @Override
 protected void verifyPlaintextPassword(
     org.apache.wss4j.dom.message.token.UsernameToken usernameToken, RequestData data)
     throws WSSecurityException {
   SubjectCreatingInterceptor.this.setSubject(
       usernameToken.getName(), usernameToken.getPassword(), false, null, null);
 }
コード例 #2
0
 @Override
 protected void verifyDigestPassword(
     org.apache.wss4j.dom.message.token.UsernameToken usernameToken, RequestData data)
     throws WSSecurityException {
   if (!supportDigestPasswords) {
     throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_AUTHENTICATION);
   }
   String user = usernameToken.getName();
   String password = usernameToken.getPassword();
   boolean isHashed = usernameToken.isHashed();
   String nonce = usernameToken.getNonce();
   String createdTime = usernameToken.getCreated();
   SubjectCreatingInterceptor.this.setSubject(user, password, isHashed, nonce, createdTime);
 }
コード例 #3
0
  protected UsernameTokenPrincipal parseTokenAndCreatePrincipal(
      Element tokenElement, boolean bspCompliant)
      throws WSSecurityException, Base64DecodingException {
    BSPEnforcer bspEnforcer = new 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(Base64.decode(ut.getNonce()));
    }
    principal.setPassword(ut.getPassword());
    principal.setCreatedTime(ut.getCreated());
    principal.setPasswordType(ut.getPasswordType());

    return principal;
  }