Contents
For a Provider webservice, a request message from a client contains the user name and password fields in the request header.
For a Consumer webservice, invoking a webservice with basic authentication enabled, the user name and password are appended to the request headers for authentication.
For more information on basic authentication protocol see RFC 1945 (Hypertext Transfer Protocol HTTP/1.0), RFC 2616 (Hypertext Transfer Protocol HTTP/1.1), and RFC 2617 (HTTP Authentication: Basic and Digest Access Authentication).
Basic authentication is supported by specifying a policy in the WSDL. A basic authentication policy can be added to the WSDL either manually or by using the WS-Policy Attachment window accessed from CASA and provided through Tango (WSIT). A basic authentication policy is specified at the root level of the WSDL and a reference to the policy is made in the WSDL Port type section, binding the policy to the endpoint.
To support basic authentication, the HTTP Binding Component defines the following WSDL elements:
The user name and password fields can be either specified as plain text in the WSDL, or specified as tokens in the WSDL and configured at runtime.
Three types of authentication mechanisms are supported for webservice consumer endpoints.
A consumer endpoint can be configured to use one of these mechanisms by adding it, as a child element, to the MustSupportBasicAuthentication element of the endpoints Policy.
To use WssTokenCompare, the Policy element must be present, and specify the username and password that are used for authentication. The username and password, extracted from the HTTP Authorization request header, are compared with the username and password specified in the Policy's WssUsernameToken10 and WssPassword elements.
The following sample WSDL contains the policy and its reference to use WssTokenCompare.. Note that an application variable token is used for the password so that the password is not exposed in the WSDL. The value of the password can be specified in the component's Using Application Variables to Define Name/Value Pairs property in NetBeans.
<wsdl:service name="echoService">
<wsdl:port name="echoPort" binding="tns:echoBinding">
<soap:address location="http://pponnala-tecra-xp.stc.com:18181/
echoService/echoPort"/>
<wsp:PolicyReference URI="#HttpBasicAuthBindingBindingPolicy"/>
</wsdl:port>
</wsdl:service>
<wsp:Policy wsu:Id="HttpBasicAuthBindingBindingPolicy">
<mysp:MustSupportBasicAuthentication on="true">
<mysp:BasicAuthenticationDetail>
<mysp:WssTokenCompare/>
</mysp:BasicAuthenticationDetail>
</mysp:MustSupportBasicAuthentication>
<mysp:UsernameToken mysp:IncludeToken="http://schemas.xmlsoap.org/ws/
2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
<wsp:Policy>
<sp:WssUsernameToken10>wilma</sp:WssUsernameToken10>
<sp:WssPassword>${pass_token}</sp:WssPassword>
</wsp:Policy>
</mysp:UsernameToken>
</wsp:Policy>
Note - The code displayed above is wrapped for display purposes.
To use AccessManager, a consuming endpoint is configured to use the Sun Access Manager to authenticate the HTTP client's credentials. The HTTP Binding Component SOAP Binding integrates seamlessly with Sun Access Manager, to authenticate the HTTP client's credentials (username and password extracted from the HTTP Authorization header) against the user's credentials in the Sun Access Manager's database.
Before authentication with Sun Access Manager can be used, an additional Binding Component configuration is required to configure the HTTP SOAP BC to use the Access Manager. This configuration is called Sun Access Manager Configuration Directory and its value is the directory where the Sun Access Manager's AMConfig.properties file can be found.
To configure the Sun Access Manager Configuration Directory, do the following:
<wsdl:service name="echoService">
<wsdl:port name="echoPort" binding="tns:echoBinding">
<soap:address location="http://pponnala-tecra-xp.stc.com:18181/
echoService/echoPort"/>
<wsp:PolicyReference URI="#HttpBasicAuthBindingBindingPolicy"/>
</wsdl:port>
</wsdl:service>
<wsp:Policy wsu:Id="HttpBasicAuthBindingBindingPolicy">
<mysp:MustSupportBasicAuthentication on="true">
<mysp:BasicAuthenticationDetail>
<mysp:AccessManager/>
</mysp:BasicAuthenticationDetail>
</mysp:MustSupportBasicAuthentication>
</wsp:Policy>
Note - The code displayed above is wrapped for display purposes.
For a tutorial demonstrating how to secure communications between a service's client and server using the Sun Java System Access Manager, see: Securing Communications In Open ESB with Sun Access Manager
To use Realm element, a consuming endpoint is configured to use Sun Realm security to authenticate the HTTP client's credentials. When the Realm element is used, a consuming endpoint is configured to utilize Sun Realm security to authenticate the HTTP client's credentials. The HTTP SOAP Binding Component integrates with Sun Realm security to authenticate the HTTP client's credentials (username and password extracted from the HTTP Authorization header) against the user's credentials in the specified Realm.
The name of the realm is specified using the Realm element's attribute, called realmName. For example, your GlassFish installation comes with a pre-configured file realm which is essentially a file-based user database. See: Admin Console Tasks for Realms
for information or creating and adding users to realms.
The following sample WSDL contains the policy and its reference to use Realm.
<wsdl:service name="echoService">
<wsdl:port name="echoPort" binding="tns:echoBinding">
<soap:address location="http://pponnala-tecra-xp.stc.com:18181/
echoService/echoPort"/>
<wsp:PolicyReference URI="#HttpBasicAuthBindingBindingPolicy"/>
</wsdl:port>
</wsdl:service>
<wsp:Policy wsu:Id="HttpBasicAuthBindingBindingPolicy">
<mysp:MustSupportBasicAuthentication on="true">
<mysp:BasicAuthenticationDetail>
<mysp:Realm realmName="file"/>
</mysp:BasicAuthenticationDetail>
</mysp:MustSupportBasicAuthenti</wsp:Policy>