Package com.sun.xml.ws.security.secext10

Examples of com.sun.xml.ws.security.secext10.SecurityHeaderType


                    log.log(Level.SEVERE, LogStringsMessages.WSS_1424_INVALID_USERNAME_TOKEN());
                    throw new XWSSecurityException("Password for the username has not been set");
                }
            }
            //Setting iterations in UsernameToken;
            AttributedString as =  new AttributedString();
            String iterate = Integer.toString(iterations);
            as.setValue(iterate);
            unToken.setIteration(as);
          
            byte[] salt = null;
            if (unToken.getSalt() == null) {
                 //Setting Salt in UsernameToken ;
                salt = pdk.get16ByteSalt();               
                AttributedString aString = new AttributedString();
                aString.setValue(Base64.encode(salt));
                unToken.setSalt(aString);
            } else {
                //Retrieving the salt already there in unToken;
                String decodeString = unToken.getSalt().getValue();
                String  iter = unToken.getIteration().getValue();
View Full Code Here


                log.log(Level.SEVERE, LogStringsMessages.WSS_1424_INVALID_USERNAME_TOKEN());
                throw new XWSSecurityException("Password for the username has not been set");
            }
        }
        //Setting iterations in UsernameToken;
        AttributedString as =  new AttributedString();
        String iterate = Integer.toString(iterations);
        as.setValue(iterate);
        unToken.setIteration(as);
        PasswordDerivedKey pdk = new PasswordDerivedKey();
        byte[] salt = null;
        if (unToken.getSalt() == null) {
            // Setting the Salt in unToken first time;
            salt = pdk.get16ByteSalt();
            AttributedString atbs =  new AttributedString();
            atbs.setValue(Base64.encode(salt));
            unToken.setSalt(atbs);
        } else {
            //Retrieving the salt already there in unToken;
            String decodeString = unToken.getSalt().getValue();
            String  iter = unToken.getIteration().getValue();
View Full Code Here

                    log.log(Level.SEVERE, LogStringsMessages.WSS_1424_INVALID_USERNAME_TOKEN());
                    throw new XWSSecurityException("Password for the username has not been set");
                }
            }
            //Setting iterations in UsernameToken;
            AttributedString as =  new AttributedString();
            String iterate = Integer.toString(iterations);
            as.setValue(iterate);
            unToken.setIteration(as);
          
            byte[] salt = null;
            if (unToken.getSalt() == null) {
                 //Setting Salt in UsernameToken ;
                salt = pdk.get16ByteSalt();               
                AttributedString aString = new AttributedString();
                aString.setValue(Base64.encode(salt));
                unToken.setSalt(aString);
            } else {
                //Retrieving the salt already there in unToken;
                String decodeString = unToken.getSalt().getValue();
                String  iter = unToken.getIteration().getValue();
View Full Code Here

                log.log(Level.SEVERE, LogStringsMessages.WSS_1424_INVALID_USERNAME_TOKEN());
                throw new XWSSecurityException("Password for the username has not been set");
            }
        }
        //Setting iterations in UsernameToken;
        AttributedString as =  new AttributedString();
        String iterate = Integer.toString(iterations);
        as.setValue(iterate);
        unToken.setIteration(as);
        PasswordDerivedKey pdk = new PasswordDerivedKey();
        byte[] salt = null;
        if (unToken.getSalt() == null) {
            // Setting the Salt in unToken first time;
            salt = pdk.get16ByteSalt();
            AttributedString atbs =  new AttributedString();
            atbs.setValue(Base64.encode(salt));
            unToken.setSalt(atbs);
        } else {
            //Retrieving the salt already there in unToken;
            String decodeString = unToken.getSalt().getValue();
            String  iter = unToken.getIteration().getValue();
View Full Code Here

        this.passwordDigestValue = Base64.encode(hash);
    }
   
    private void setValues(){
        if(usernameValue != null){
            AttributedString ut = objFac.createAttributedString();
            ut.setValue(usernameValue);
            setUsername(ut);
        }
       
        if (passwordValue != null && !MessageConstants._EMPTY.equals(passwordValue) ){
            AttributedString pw = objFac.createAttributedString();
            if (MessageConstants.PASSWORD_DIGEST_NS == passwordType) {
                try {
                    createDigest();
                } catch (com.sun.xml.wss.impl.SecurityTokenException ex) {
                    ex.printStackTrace();
                }
                pw.setValue(passwordDigestValue);
                setPassword(pw);
            } else{
                pw.setValue(passwordValue);
                setPassword(pw);
            }
            QName qname = new QName("Type");
            pw.getOtherAttributes().put(qname, passwordType);
           
        }
       
        if(nonceValue != null){
            AttributedString non = objFac.createAttributedString();
            non.setValue(nonceValue);
            setNonce(non);
            if (nonceEncodingType != null) {
                QName qname = new QName("EncodingType");
                non.getOtherAttributes().put(qname, nonceEncodingType);
            }
        }
       
        if(createdValue != null){
            AttributedString cr = objFac.createAttributedString();
            cr.setValue(createdValue);
            setCreated(cr);
        }
       
        valuesSet = true;
    }
View Full Code Here

    /**
     * Create a BinarySecurity Token Header element.
     *
     */
    public BinarySecurityToken createBinarySecurityToken(String id,String valueType,String encodingType,byte[] token){
        BinarySecurityTokenType bst = new BinarySecurityTokenType();
        bst.setValueType(valueType);
        bst.setId(id);
        bst.setEncodingType(encodingType);
        //bst.setValue(Base64.encode(cert));
        bst.setValue(token);
        return new BinarySecurityToken(bst,soapVersion);
    }
View Full Code Here

            // Create Identity element with a BinarySecurityTOken for
            // the server certificate

            // Create BinarySecurityToken
            String id = UUID.randomUUID().toString();
            BinarySecurityTokenType bst = new BinarySecurityTokenType();
            bst.setValueType(MessageConstants.X509v3_NS);
            bst.setId(id);
            bst.setEncodingType(MessageConstants.BASE64_ENCODING_NS);
            try {
                bst.setValue(((X509Certificate)identity).getEncoded());
            }catch (CertificateEncodingException ex){
                throw new WSTrustException(ex.getMessage());
            }
            JAXBElement<BinarySecurityTokenType> bstElem = new com.sun.xml.ws.security.secext10.ObjectFactory().createBinarySecurityToken(bst);
           
View Full Code Here

            public XMLStreamReader readAsXMLStreamReader() throws XMLStreamException {
                XMLStreamReader reader = null;
                try {

                    String id = PolicyUtil.randomUUID();
                    BinarySecurityTokenType bst = new BinarySecurityTokenType();
                    bst.setValueType(MessageConstants.X509v3_NS);
                    bst.setId(id);
                    bst.setEncodingType(MessageConstants.BASE64_ENCODING_NS);
                    if (cs != null) {
                        bst.setValue(cs.getEncoded());
                    }
                    JAXBElement<BinarySecurityTokenType> bstElem = new com.sun.xml.ws.security.secext10.ObjectFactory().createBinarySecurityToken(bst);
                    IdentityType identityElement = new IdentityType();
                    identityElement.getDnsOrSpnOrUpn().add(bstElem);
View Full Code Here

    /**
     * Create a BinarySecurity Token Header element.
     *
     */
    public BinarySecurityToken createBinarySecurityToken(String id,String valueType,String encodingType,byte[] token){
        BinarySecurityTokenType bst = new BinarySecurityTokenType();
        bst.setValueType(valueType);
        bst.setId(id);
        bst.setEncodingType(encodingType);
        //bst.setValue(Base64.encode(cert));
        bst.setValue(token);
        return new BinarySecurityToken(bst,soapVersion);
    }
View Full Code Here

                    StringBuffer sb = new StringBuffer();
                    sb.append("#");
                    sb.append(id);
                    return ((DirectReference)obj).getURI().equals(sb.toString());
                }else if(obj instanceof KeyIdentifierType){
                    KeyIdentifierType ki = (KeyIdentifierType)obj;
                    String valueType = ki.getValueType();
                    if(valueType.equals(MessageConstants.WSSE_SAML_KEY_IDENTIFIER_VALUE_TYPE) ||
                            valueType.equals(MessageConstants.WSSE_SAML_v2_0_KEY_IDENTIFIER_VALUE_TYPE)){
                        if(id.equals(ki.getValue())){
                            return true;
                        }
                    }
                }
            }
View Full Code Here

TOP

Related Classes of com.sun.xml.ws.security.secext10.SecurityHeaderType

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.