authentication Archive

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);
}
}