Author: svkrish
Date: Tue Oct 23 03:45:20 2007
New Revision: 587451
URL: http://svn.apache.org/viewvc?rev=587451&view=rev
Log:
adding some more code to the password handlers to give users an idea of how to
typically deal with authentication
Modified:
incubator/tuscany/java/sca/samples/helloworld-ws-service-secure/README
incubator/tuscany/java/sca/samples/helloworld-ws-service-secure/src/main/java/helloworld/ServerPWCBHandler.java
Modified: incubator/tuscany/java/sca/samples/helloworld-ws-service-secure/README
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/helloworld-ws-service-secure/README?rev=587451&r1=587450&r2=587451&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/helloworld-ws-service-secure/README
(original)
+++ incubator/tuscany/java/sca/samples/helloworld-ws-service-secure/README Tue
Oct 23 03:45:20 2007
@@ -48,7 +48,13 @@
deploys the helloworldws
.composite and then waits for the
service to be called via web
services
- ServerPWCBHandler.java - callback handler to
authenticate client userid and password
+ ServerPWCBHandler.java - callback handler to
authenticate client userid and password.
+
The handle(Callback[] callbacks) method of this class typically contains
+
code for accessing user registries and retrieving passwords
+
for user identifiers sent by the client and verifying them
+
against the password sent by the client. For example
+
here is where one could access LDAP registries to obtain or
+
compare user identities and passwords.
resources/
wsdl/
helloworld.wsdl - the service description that
describes
Modified:
incubator/tuscany/java/sca/samples/helloworld-ws-service-secure/src/main/java/helloworld/ServerPWCBHandler.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/helloworld-ws-service-secure/src/main/java/helloworld/ServerPWCBHandler.java?rev=587451&r1=587450&r2=587451&view=diff
==============================================================================
---
incubator/tuscany/java/sca/samples/helloworld-ws-service-secure/src/main/java/helloworld/ServerPWCBHandler.java
(original)
+++
incubator/tuscany/java/sca/samples/helloworld-ws-service-secure/src/main/java/helloworld/ServerPWCBHandler.java
Tue Oct 23 03:45:20 2007
@@ -34,9 +34,21 @@
public void handle(Callback[] callbacks) throws IOException,
UnsupportedCallbackException {
for (int i = 0; i < callbacks.length; i++) {
- System.out.println("*** Calling Server User/Passwd
Handler....");
- WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
- pwcb.setPassword("TuscanyWsUserPasswd");
+ System.out.println("*** Calling Server User/Passwd Handler....");
+ WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
+ System.out.println("User Id = " + pwcb.getIdentifer());
+ System.out.println("Password = " + pwcb.getPassword());
+
+ if ( pwcb.getUsage() == WSPasswordCallback.USERNAME_TOKEN ) {
+ if ( pwcb.getIdentifer().equals("TuscanyWsUser") &&
+ pwcb.getPassword().equals("TuscanyWsUserPasswd") ){
+ return;
+ } else {
+ throw new UnsupportedCallbackException(pwcb,
"Authentication Failed : UserId - Password mismatch");
+ }
+ } else if ( pwcb.getUsage() == WSPasswordCallback.SIGNATURE ) {
+ pwcb.setPassword("TuscanyWsUserPasswd");
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]