-
1. Re: method permissions??
agreatham Oct 23, 2001 4:33 PM (in response to dlabrosse)Perhaps the "Admin" security role hasn't been defined yet? Modify the descriptor to look like the following and try again:
<assembly-descriptor>
<security-role>
<role-name>Admin</role-name>
</security-role>
<method-permission>
<role-name>Admin</role-name>
<ejb-name>ResellerTableBean</ejb-name>
<method-name>*</method-name>
</method-permission>
</assembly-descriptor>
Hope this helps. -
2. Re: method permissions??
starksm64 Oct 27, 2001 7:57 PM (in response to dlabrosse)You assign permissions to a ResellerTableBean and
yet the console shows a TarrifServiceBean complaining
about no permissions. Set the permission for the
TarrifServiceBean. -
3. Re: method permissions??
dlabrosse Oct 29, 2001 12:11 PM (in response to dlabrosse)Thanks for your input guys....problem solved. I was making a slight error in placing my </assembly-descriptor> element inside my </enterprise-beans> element instead of outside it. I now have complete control over my method permissions etc.
cheers.
-Daniel -
4. Re: method permissions??
eric138 Nov 3, 2001 10:07 PM (in response to dlabrosse)Hi,
Would you pleased to show me the detail that how to Login for accessing the EJB ?
Best regards,
Eric -
5. Re: method permissions??
dlabrosse Nov 5, 2001 7:04 AM (in response to dlabrosse)here's the code. be sure to set
-Djava.security.auth.login.config==auth.conf
class TestClient
{
static class AppCallbackHandler implements CallbackHandler
{
private String username;
private char[] password;
public AppCallbackHandler(String username, char[] password)
{
this.username = username;
this.password = password;
}
public void handle(Callback[] callbacks) throws
java.io.IOException, UnsupportedCallbackException
{
for (int i = 0; i < callbacks.length; i++)
{
if (callbacks instanceof NameCallback)
{
NameCallback nc = (NameCallback)callbacks;
nc.setName(username);
}
else if (callbacks instanceof PasswordCallback)
{
PasswordCallback pc = (PasswordCallback)callbacks;
pc.setPassword(password);
}
else
{
throw new UnsupportedCallbackException(callbacks, "Unrecognized Callback");
}
}
}
}
public static void main(String[] args)
{
String user = "fred";
String pass = new String("fredpass");
try
{
AppCallbackHandler handler = new AppCallbackHandler(user, pass.toCharArray());
LoginContext lc = new LoginContext("client-login", handler);
System.out.println("Created LoginContext");
lc.login();
}
catch (LoginException le)
{
System.out.println("Login failed");
le.printStackTrace();
}
try
{
Properties props = System.getProperties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
props.put(Context.PROVIDER_URL, "localhost:1099");
InitialContext jndiContext = new InitialContext(props);
System.out.println("Got context");
Object ref = jndiContext.lookup("ejb/MyEJB");
......etc