Skip to content

Securing Webservices using BASIC Authentication on Weblogic Server.

To secure the Webservice to use Basic Authentication, we just need to use the @RolesAllowed annotation. No change needs to be done in the deployment descriptor.

Here is a sample JWS.

package demo;

import javax.jws.*;

import weblogic.jws.security.RolesAllowed;
import weblogic.jws.security.SecurityRole;

@RolesAllowed ( {
@SecurityRole (role=”Adminstrators”,mapToPrincipals{“weblogic”}),
}
)

@WebService
public class TestBasic {

@WebMethod
public void hello(String test) {
System.out.println(“print”+test);
}
}

3 Comments

  1. Anonymous

    How to do the same thing in JAXWS

    Posted on 14-Jan-10 at 7:58 am | Permalink
  2. Anonymous

    Where is the Client for ..your WebService ?

    Posted on 14-Jan-10 at 7:58 am | Permalink
  3. Faisal Khan

    My Fried Joy has explained it in one of the forum replies I guess…

    http://forums.oracle.com/forums/thread.jspa?threadID=1007835&tstart=0

    Posted on 14-Jan-10 at 8:00 am | Permalink

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*