private void checkSignedUsernameToken(List<SecurityEvent> results) throws WSSecurityException { if (!signUsernameToken) { return; } boolean isUsernameTokenSigned = false; for (SecurityEvent signedEvent : results) { AbstractSecuredElementSecurityEvent securedEvent = (AbstractSecuredElementSecurityEvent)signedEvent; if (!securedEvent.isSigned()) { continue; } List<QName> signedPath = securedEvent.getElementPath(); if (isUsernameToken(signedPath)) { isUsernameTokenSigned = true; break; } } if (!isUsernameTokenSigned) { throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, new Exception("The UsernameToken is not signed")); } }
private void checkEncryptedUsernameToken(List<SecurityEvent> results) throws WSSecurityException { if (!encryptUsernameToken) { return; } boolean isUsernameTokenEncrypted = false; for (SecurityEvent encryptedEvent : results) { AbstractSecuredElementSecurityEvent securedEvent = (AbstractSecuredElementSecurityEvent)encryptedEvent; if (!securedEvent.isEncrypted()) { continue; } List<QName> encryptedPath = securedEvent.getElementPath(); if (isUsernameToken(encryptedPath)) { isUsernameTokenEncrypted = true; break; } } if (!isUsernameTokenEncrypted) { throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, new Exception("The UsernameToken is not encrypted")); } }
private void checkSignedUsernameToken(List<SecurityEvent> results) throws WSSecurityException { if (!signUsernameToken) { return; } boolean isUsernameTokenSigned = false; for (SecurityEvent signedEvent : results) { AbstractSecuredElementSecurityEvent securedEvent = (AbstractSecuredElementSecurityEvent)signedEvent; if (!securedEvent.isSigned()) { continue; } List<QName> signedPath = securedEvent.getElementPath(); if (isUsernameToken(signedPath)) { isUsernameTokenSigned = true; break; } } if (!isUsernameTokenSigned) { throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, new Exception("The UsernameToken is not signed")); } }
private void checkEncryptedUsernameToken(List<SecurityEvent> results) throws WSSecurityException { if (!encryptUsernameToken) { return; } boolean isUsernameTokenEncrypted = false; for (SecurityEvent encryptedEvent : results) { AbstractSecuredElementSecurityEvent securedEvent = (AbstractSecuredElementSecurityEvent)encryptedEvent; if (!securedEvent.isEncrypted()) { continue; } List<QName> encryptedPath = securedEvent.getElementPath(); if (isUsernameToken(encryptedPath)) { isUsernameTokenEncrypted = true; break; } } if (!isUsernameTokenEncrypted) { throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, new Exception("The UsernameToken is not encrypted")); } }