Package org.jboss.ws.extensions.security

Examples of org.jboss.ws.extensions.security.WSSecurityException


/*     */   public KeyIdentifier(Element element) throws WSSecurityException
/*     */   {
/*  65 */     this.doc = element.getOwnerDocument();
/*     */
/*  67 */     if (!"KeyIdentifier".equals(element.getLocalName())) {
/*  68 */       throw new WSSecurityException("Invalid message, invalid local name on a KeyIdentifier");
/*     */     }
/*  70 */     String valueType = element.getAttribute("ValueType");
/*  71 */     if ((valueType == null) || (valueType.length() == 0)) {
/*  72 */       throw new WSSecurityException("Inavliad message, KeyIdentifier element is missing an ValueType");
/*     */     }
/*  74 */     if (!"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509SubjectKeyIdentifier".equals(valueType)) {
/*  75 */       throw new WSSecurityException("Currently only SubjectKeyIdentifiers are supported, was passed: " + valueType);
/*     */     }
/*     */
/*  78 */     this.value = XMLUtils.getFullTextChildrenFromElement(element);
/*     */   }
View Full Code Here


/*     */   }
/*     */
/*     */   public void referenceToken(BinarySecurityToken token) throws WSSecurityException
/*     */   {
/*  83 */     if (!(token instanceof X509Token)) {
/*  84 */       throw new WSSecurityException("KeyIdentifier tried to reference something besides an X509 token");
/*     */     }
/*  86 */     X509Token x509 = (X509Token)token;
/*  87 */     X509Certificate cert = x509.getCert();
/*     */
/*  90 */     byte[] encoded = cert.getExtensionValue("2.5.29.14");
/*  91 */     if (encoded == null) {
/*  92 */       throw new WSSecurityException("Certificate did not contain a subject key identifier!");
/*     */     }
/*     */
/*  95 */     int trunc = encoded.length - 4;
/*     */
/*  97 */     byte[] identifier = new byte[trunc];
View Full Code Here

/*     */     {
/* 126 */       return Base64.decode(this.value);
/*     */     }
/*     */     catch (Base64DecodingException e) {
/*     */     }
/* 130 */     throw new WSSecurityException("Error decoding key identifier", e);
/*     */   }
View Full Code Here

/* 55 */       this.signature = new XMLSignature(element, null);
/* 56 */       this.publicKey = resolver.resolvePublicKey(this.signature.getKeyInfo());
/*    */     }
/*    */     catch (XMLSecurityException e)
/*    */     {
/* 60 */       throw new WSSecurityException("Error decoding xml signature: " + e.getMessage(), e);
/*    */     }
/*    */   }
View Full Code Here

/*     */   public UsernameToken(Element element) throws WSSecurityException
/*     */   {
/*  57 */     this.doc = element.getOwnerDocument();
/*  58 */     String id = element.getAttributeNS("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd", "Id");
/*  59 */     if ((id == null) || (id.length() == 0)) {
/*  60 */       throw new WSSecurityException("Invalid message, UsernameToken is missing an id");
/*     */     }
/*  62 */     setId(id);
/*     */
/*  64 */     Element child = Util.getFirstChildElement(element);
/*  65 */     if ((child == null) || (!"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd".equals(child.getNamespaceURI())) || (!"Username".equals(child.getLocalName()))) {
/*  66 */       throw new WSSecurityException("Username child expected in UsernameToken element");
/*     */     }
/*  68 */     this.username = XMLUtils.getFullTextChildrenFromElement(child);
/*     */
/*  70 */     child = Util.getNextSiblingElement(child);
/*  71 */     if ((child == null) || (!"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd".equals(child.getNamespaceURI())) || (!"Password".equals(child.getLocalName()))) {
/*  72 */       throw new WSSecurityException("Password child expected in UsernameToken element");
/*     */     }
/*  74 */     this.password = XMLUtils.getFullTextChildrenFromElement(child);
/*     */   }
View Full Code Here

/*     */   public Timestamp(Element element) throws WSSecurityException
/*     */   {
/*  63 */     this.doc = element.getOwnerDocument();
/*  64 */     String id = element.getAttributeNS("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd", "Id");
/*  65 */     if ((id == null) || (id.length() == 0)) {
/*  66 */       throw new WSSecurityException("Invalid message, Timestamp is missing an id");
/*     */     }
/*  68 */     this.id = id;
/*     */
/*  70 */     Element child = Util.getFirstChildElement(element);
/*  71 */     if ((child == null) || (!"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd".equals(child.getNamespaceURI())) || (!"Created".equals(child.getLocalName()))) {
/*  72 */       throw new WSSecurityException("Created child expected in Timestamp element");
/*     */     }
/*  74 */     this.created = SimpleTypeBindings.unmarshalDateTime(XMLUtils.getFullTextChildrenFromElement(child));
/*     */
/*  76 */     child = Util.getNextSiblingElement(child);
/*  77 */     if (child == null) {
View Full Code Here

/*    */   }
/*    */
/*    */   public SecurityTokenReference(Element element) throws WSSecurityException
/*    */   {
/* 50 */     if (!"SecurityTokenReference".equals(element.getLocalName())) {
/* 51 */       throw new WSSecurityException("SecurityTokenReference was passed an invalid local name");
/*    */     }
/* 53 */     String id = element.getAttributeNS("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd", "Id");
/* 54 */     if ((id == null) || (id.length() == 0)) {
/* 55 */       setId(id);
/*    */     }
/* 57 */     Element child = Util.getFirstChildElement(element);
/* 58 */     if (child == null) {
/* 59 */       throw new WSSecurityException("Invalid message, SecurityTokenRefence is empty: " + id);
/*    */     }
/* 61 */     this.reference = Reference.getReference(child);
/*    */   }
View Full Code Here

/*     */   public DirectReference(Element element) throws WSSecurityException
/*     */   {
/*  65 */     this.doc = element.getOwnerDocument();
/*     */
/*  67 */     if (!"Reference".equals(element.getLocalName())) {
/*  68 */       throw new WSSecurityException("Invalid message, invalid local name on a DirectReference");
/*     */     }
/*  70 */     String uri = element.getAttribute("URI");
/*  71 */     if ((uri == null) || (uri.length() == 0)) {
/*  72 */       throw new WSSecurityException("Inavliad message, Reference element is missing a URI");
/*     */     }
/*  74 */     setUri(uri);
/*     */
/*  76 */     String valueType = element.getAttribute("ValueType");
/*  77 */     if ((valueType == null) || (valueType.length() == 0)) {
/*  78 */       throw new WSSecurityException("Inavliad message, Reference element is missing a ValueType");
/*     */     }
/*  80 */     setValueType(valueType);
/*     */   }
View Full Code Here

/*     */   {
/*  51 */     super(element.getOwnerDocument());
/*     */
/*  53 */     String id = element.getAttributeNS("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd", "Id");
/*  54 */     if ((id == null) || (id.length() == 0)) {
/*  55 */       throw new WSSecurityException("Invalid message, BinarySecurityToken is missing an id");
/*     */     }
/*  57 */     setId(id);
/*     */
/*  59 */     if (!"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary".equals(element.getAttribute("EncodingType"))) {
/*  60 */       throw new WSSecurityException("Invalid encoding type (only base64 is supported) for token:" + id);
/*     */     }
/*  62 */     setCert(decodeCert(XMLUtils.getFullTextChildrenFromElement(element)));
/*     */   }
View Full Code Here

/* 104 */       CertificateFactory factory = CertificateFactory.getInstance("X.509");
/* 105 */       return (X509Certificate)factory.generateCertificate(new ByteArrayInputStream(Base64.decode(data)));
/*     */     }
/*     */     catch (Exception e) {
/*     */     }
/* 109 */     throw new WSSecurityException("Error decoding BinarySecurityToken: " + e.getMessage());
/*     */   }
View Full Code Here

TOP

Related Classes of org.jboss.ws.extensions.security.WSSecurityException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.