Michael

Good question!

So you need to basically write a mediator that grabs the Username from
the MessageContext and then checks it. If it succeeds you can pass the
message on, otherwise you can fault back.

The uid/pw can be extracted like this:

Map map = (Map) msgCtx.getProperty(MessageContext.TRANSPORT_HEADERS);
           String tmp = (String) map.get("Authorization");
           String username = null;
           String password = null;

           if (tmp != null) {
               tmp = tmp.trim();
           }
           if (tmp != null && tmp.startsWith("Basic ")) {
               tmp = new String(Base64.decode(tmp.substring(6)));
               int i = tmp.indexOf(':');
               if (i == -1) {
                   username = tmp;
               } else {
                   username = tmp.substring(0, i);
               }

               if (i != -1) {
                   password = tmp.substring(i + 1);
                   if (password != null && password.equals("")) {
                       password = null;
                   }
               }
           }

You can see how to fault by looking at the fault mediator.

If you've written a mediator before -- or want the challenge -- it
should be pretty straightforward. Would you like to contribute it
back?

If you need help I'll be happy to help out.

Paul

On 1/5/07, Michael Buchholz <[EMAIL PROTECTED]> wrote:
Hi,

first: congratulations to the synapse dev-team for graduating from the
incubator!

second: I´m a little stuck with a feature I need...
I would like to use synapse as a proxy for internal web-services. The
samples show how to achieve this. But in addition to the proxy
functionality I need that all proxy-services require the clients to
authenticate with a username (password is not required...).

Also the authentication if the username is correct or not must be done
by a java class I provide.

Any idea how this can be achieved? HTTPS with basic authentication by a
self written username check java class would be sufficient...

Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Paul Fremantle
VP/Technology, WSO2 and OASIS WS-RX TC Co-chair

http://bloglines.com/blog/paulfremantle
[EMAIL PROTECTED]

"Oxygenating the Web Service Platform", www.wso2.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to