alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Glassfish example source code file (wss-client-config-2.0.xml)

This example Glassfish source code file (wss-client-config-2.0.xml) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Glassfish tags/keywords

cddl, gpl, gpl, license, license, module, options, soap-body, the, usernametoken, usernametoken, version, version, when

The Glassfish wss-client-config-2.0.xml source code

<!--

    DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.

    Copyright (c) 2004-2010 Oracle and/or its affiliates. All rights reserved.

    The contents of this file are subject to the terms of either the GNU
    General Public License Version 2 only ("GPL") or the Common Development
    and Distribution License("CDDL") (collectively, the "License").  You
    may not use this file except in compliance with the License.  You can
    obtain a copy of the License at
    https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
    or packager/legal/LICENSE.txt.  See the License for the specific
    language governing permissions and limitations under the License.

    When distributing the software, include this License Header Notice in each
    file and include the License file at packager/legal/LICENSE.txt.

    GPL Classpath Exception:
    Oracle designates this particular file as subject to the "Classpath"
    exception as provided by Oracle in the GPL Version 2 section of the License
    file that accompanied this code.

    Modifications:
    If applicable, add the following below the License Header, with the fields
    enclosed by brackets [] replaced by your own identifying information:
    "Portions Copyright [year] [name of copyright owner]"

    Contributor(s):
    If you wish your version of this file to be governed by only the CDDL or
    only the GPL Version 2, indicate your decision by adding "[Contributor]
    elects to include this software in this distribution under the [CDDL or GPL
    Version 2] license."  If you don't indicate a single choice of license, a
    recipient has the option to distribute your version of this file under
    either the CDDL, the GPL Version 2 or to extend the choice of license to
    its licensees as provided above.  However, if you add GPL Version 2 code
    and therefore, elected the GPL Version 2 license, then the option applies
    only if the new code is made subject to such option by the copyright
    holder.

-->

<!--
 This client side config file pairs with wss-server-config-2.0.xml on the server
 and supports the following UseCases:
 Usecase 2: Encrypted UsernameToken
 Usecase 3: Encrypted UsernameToken and MessageBody
 Usecase 4: Response Encryption Key Learnt from Incoming Message

 Certificate Alias Information :
 1. A certificateAlias under the <xwss:Encrypt> element signifies the certificate
    of the recipient of the message.
 2. A certificateAlias under the <xwss:Sign> element signifies the certificate of the
    sender.
                                                                                                                                               
 NOTE:
                                                                                                                                               
   1. the certificateAlias has the above meaning for all the Sign and Encrypt elements below
   2. there are several Sign and Encrypt elements below and similarly several RequireSignature and
      RequireEncryption elements. Which of them would be actually used at runtime will depend on
      the AuthPolicy passed to the module.
                                                                                                                                               
      For Example : if Auth-Source=Sender then only the <xwss:UsernameToken> elements will be used
      and none of the <xwss:Sign> elements will be used.
      If Auth-Source=Content then the <xwss:Sign> element will be used
                                                                                                                                               
   3.  The different variations of <xwss:Encrypt> elements in this configuration file are to accomodate
       default encryption of the UsernameToken.
                                                                                                                                               
   4.  The actual certificate alias to be used for any Signature operation can be modified during AuthModule
       initialization by setting the alias as the value of "signature.key.alias" property in the Module Options Map.
   5.  The actual certificate alias to be used for any Encrypt operation can be modified during AuthModule
       initialization by setting the alias as the value of "encryption.key.alias" property in the Module Options Map.
                                                                                                                                               
   6. Debug Dumping of Messages can be enabled by setting the "debug" property in the Module Options Map to "true" during
      AuthModule initialization.
   7. The Actual configuration file to be used by an Authmodule can be changed by setting the property "security.config" in
      the Module Options Map to point to the configuration file location.
   8. When the "security.config" property is not set during module initialization then a client auth module will use wss-client-config-2.0.xml
      by default.
   9. When the "security.config" property is not set during module initialization then a server auth module will use wss-server-config-2.0.xml
      by default.
   10. The property "dynamic.username.password" when set during module initialization to "true" will signal the provider runtime to collect the username and password from the CallbackHandler for each request. When this property is set to "false" or if the property is not set then the username and password for  wsse:UsernameToken(s) is collected once during Module Initialization.

-->

<xwss:SecurityConfiguration xmlns:xwss="http://java.sun.com/xml/ns/xwss/config" 
                            dumpMessages="false">                           
    <xwss:Timestamp/>
    <xwss:Encrypt>
        <xwss:X509Token certificateAlias="s1as"/>
        <xwss:KeyEncryptionMethod algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
    </xwss:Encrypt>    
    <xwss:Encrypt>
        <xwss:X509Token certificateAlias="s1as"/>
        <xwss:KeyEncryptionMethod algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
        <xwss:Target type="qname">{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}UsernameToken
    </xwss:Encrypt>    
    <xwss:Encrypt>
        <xwss:X509Token certificateAlias="s1as"/>
        <xwss:KeyEncryptionMethod algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
        <xwss:Target type="qname">{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}UsernameToken
        <xwss:Target type="qname">SOAP-BODY
    </xwss:Encrypt>    
    <xwss:Encrypt>
        <xwss:X509Token certificateAlias="s1as"/>
        <xwss:KeyEncryptionMethod algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
        <xwss:Target type="qname">SOAP-BODY
        <xwss:Target type="qname">{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}UsernameToken
    </xwss:Encrypt>    
    <xwss:Sign>
        <xwss:X509Token certificateAlias="s1as"/>
    </xwss:Sign>
    <xwss:UsernameToken digestPassword="false" useNonce="true"/>

    <xwss:RequireUsernameToken nonceRequired="true" passwordDigestRequired="false"/>   
    <xwss:RequireSignature>
        <xwss:Target type="qname">SOAP-BODY
    </xwss:RequireSignature>     
    <xwss:RequireEncryption>
        <xwss:Target type="qname">SOAP-BODY
    </xwss:RequireEncryption>
    <xwss:RequireEncryption>
        <xwss:Target type="qname">{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}UsernameToken
    </xwss:RequireEncryption>    
    <xwss:RequireEncryption>
        <xwss:Target type="qname">{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}UsernameToken
        <xwss:Target type="qname">SOAP-BODY
    </xwss:RequireEncryption>    
    <xwss:RequireEncryption>
        <xwss:Target type="qname">SOAP-BODY
        <xwss:Target type="qname">{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}UsernameToken
    </xwss:RequireEncryption>    
</xwss:SecurityConfiguration>

Other Glassfish examples (source code examples)

Here is a short list of links related to this Glassfish wss-client-config-2.0.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.