~tritone-team/tritone/eucalyptus

« back to all changes in this revision

Viewing changes to clc/modules/wsstack/src/main/java/com/eucalyptus/ws/util/WSSecurity.java

  • Committer: Bazaar Package Importer
  • Author(s): Dustin Kirkland
  • Date: 2009-12-01 21:09:28 UTC
  • mto: This revision was merged to the branch mainline in revision 75.
  • Revision ID: james.westby@ubuntu.com-20091201210928-o2dvg0ubljhb0ft6
Tags: upstream-1.6.1~bzr1083
ImportĀ upstreamĀ versionĀ 1.6.1~bzr1083

Show diffs side-by-side

added added

removed removed

Lines of Context:
171
171
  public static Element getSecurityElement( final Element env ) {
172
172
    final SOAPConstants soapConstants = WSSecurityUtil.getSOAPConstants( env );
173
173
    final Element soapHeaderElement = ( Element ) WSSecurityUtil.getDirectChildElement( env, soapConstants.getHeaderQName( ).getLocalPart( ), soapConstants.getEnvelopeURI( ) );
 
174
    if(soapHeaderElement != null) {
174
175
    final Element securityNode = ( Element ) WSSecurityUtil.getDirectChildElement( soapHeaderElement, WSConstants.WSSE_LN, WSConstants.WSSE_NS );
175
176
    return securityNode;
 
177
    }
 
178
    return null;
176
179
  }
177
180
 
178
181
  public static X509Certificate getVerifiedCertificate( SOAPEnvelope envelope ) throws WSSecurityException, XMLSignatureException {
181
184
    elem.build( );
182
185
    final Element env = ( ( Element ) elem );
183
186
    final Element securityNode = getSecurityElement( env );
 
187
    if(securityNode != null) {
184
188
    final Element signatureNode = getSignatureElement( securityNode );
185
 
    final XMLSignature sig = getXmlSignature( signatureNode );
 
189
    final XMLSignature sig = getXmlSignature( signatureNode );    
186
190
    if ( sig.getKeyInfo( ) == null ) throw new WSSecurityException( WSSecurityException.SECURITY_TOKEN_UNAVAILABLE );
187
191
    X509Certificate cert = verifySignature( securityNode, sig );
188
192
    return cert;
 
193
    }
 
194
    return null;
189
195
  }
190
196
 
191
197
}