Hi Nizar,

You will get not the alias, but client certificate subject DN.
You can use it to find certificate in keystore.

Code on the service side:
                @Resource
                WebServiceContext webServiceContext;

                MessageContext context = webServiceContext.getMessageContext();
                SecurityContext sc = (SecurityContext) 
context.get(SecurityContext.class.getName());
                Principal principal = sc.getUserPrincipal();
                System.out.println(principal.getName());

Regards,
Andrei.

-----Original Message-----
From: nizarrazin [mailto:[email protected]] 
Sent: Donnerstag, 11. Oktober 2012 16:09
To: [email protected]
Subject: Re: Extract client information in the service side

Hello Andrei,

Thank you for your response.
I want in the service side detect which client trying to connect to this 
service.
In other words, I want if possible catch the alias of the client certificate in 
the service interceptor that I can load it in the service keystore and have the 
information I need.

Thanks
Regards

2012/10/11 Andrei Shakirin [via CXF] <
[email protected]>

> Hi Nizar,
>
> Not sure what you exactly mean under service Callback, but you can use 
> following code in interceptors or service implementation to get client
> principal:
>
> Interceptor:
>         SecurityContext sc = message.get(SecurityContext.class);
>         Principal principal = sc.getUserPrincipal();
>
> Service implementation:
>         @Resource
>         WebServiceContext webServiceContext;
>
>   SecurityContext sc =
> webServiceContext.getMessageContext().get(SecurityContext.class);
>   Principal principal = sc.getUserPrincipal();
>
> Reagrds,
> Andrei.
>
> -----Original Message-----
> From: nizarrazin [mailto:[hidden 
> email]<http://user/SendEmail.jtp?type=node&node=5716393&i=0>]
>
> Sent: Mittwoch, 10. Oktober 2012 17:47
> To: [hidden email] 
> <http://user/SendEmail.jtp?type=node&node=5716393&i=1>
> Subject: Extract client information in the service side
>
> Hello everyone,
>
> I have run a simple App using WSS4j and Apache CXF, I used x509 
> certificate to sign message, and every thing works well.
> Now I want to extract in service CallBack some informations (alias for
> example) of the connecting client.
> Is that possible, how to do that?
>
> Thanks
>
>
>
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/Extract-client-information-in-the-serv
> ice-side-tp5716307.html Sent from the cxf-user mailing list archive at 
> Nabble.com.
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the 
> discussion
> below:
>
> http://cxf.547215.n5.nabble.com/Extract-client-information-in-the-serv
> ice-side-tp5716307p5716393.html  To unsubscribe from Extract client 
> information in the service side, click 
> here<http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=un
> subscribe_by_code&node=5716307&code=bml6YXIuY2hhb3VhY2hpQGdtYWlsLmNvbX
> w1NzE2MzA3fC01OTkwOTY2MzY=>
> .
> NAML<http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=ma
> cro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.name
> spaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.
> view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabbl
> e%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email
> %21nabble%3Aemail.naml>
>



--
Nizar Chaouachi
Software engineer
Tel :+33 0617504612




--
View this message in context: 
http://cxf.547215.n5.nabble.com/Extract-client-information-in-the-service-side-tp5716307p5716395.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to