[jboss-user] [Beginners Corner] - Re: Secure access to an EJB3.0
Luftballon
do-not-reply at jboss.com
Sat May 23 16:14:59 EDT 2009
Problem solved: the login must be done over the org.jboss.security.client.SecurityClient
public class SecureClient {
public static void main(String[] args) {
Context ctx;
try {
SecurityClient securityClient = SecurityClientFactory.getSecurityClient();
securityClient.setSimple("admin", "adminpas");
securityClient.login();
ctx = new InitialContext();
Secure bean = (Secure)ctx.lookup("SecureBean/remote");
System.out.println(bean.forUsers());
} catch (NamingException e) {
e.printStackTrace();
} catch (EJBAccessException e){
System.out.println("Nicht berechtigt");
} catch (Exception e) {
e.printStackTrace();
}
}
}
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4232881#4232881
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4232881
More information about the jboss-user
mailing list