Our default login mechanism is not through the JNDI InitialContext. If
you want to do that you need to use the
org.jboss.security.jndi.LoginInitialContextFactory:
Properties env = new Properties();
// Try with a login that should succeed
env.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.jboss.security.jndi.LoginInitialContextFactory");
env.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099/");
env.setProperty(Context.SECURITY_CREDENTIALS, "theduke");
env.setProperty(Context.SECURITY_PRINCIPAL, "jduke");
env.setProperty(Context.SECURITY_PROTOCOL, "myLoginConfig");
where myLoginConfig is a JAAS login configuration that has at least the
JBoss ClientLogin module.
--
xxxxxxxxxxxxxxxxxxxxxxxx
Scott Stark
Chief Technology Officer
JBoss Group, LLC
xxxxxxxxxxxxxxxxxxxxxxxx
Pham Thanh Quan wrote:
> Hi all,
>
>
>
> When I run the following piece of code:
>
>
>
> Properties properties = new Properties();
>
> properties.put("java.naming.provider.url", url);
>
> properties.put("java.naming.factory.initial", jndiContextClass);
>
> properties.setProperty(Context.SECURITY_PRINCIPAL, "administrator");
>
> properties.setProperty(Context.SECURITY_CREDENTIALS, "administrator");
>
> Context context = new InitialContext(properties);
>
> PromotionInfoManagerHome promotionInfoManagerHome =
> (PromotionInfoManagerHome) context.lookup("PromotionInfoManager");
>
> PromotionInfoManager promotionInfoManager =
> promotionInfoManagerHome.create();
>
> PromotionProgramValue promotionProgramValue = new
> PromotionProgramValue("test", "test", "published", null, false);
>
> promotionInfoManager.createPromotionProgram(promotionProgramValue);
>
>
>
> I get the following exception:
>
>
>
> java.rmi.ServerException: RemoteException occurred in server thread;
> nested exception is:
>
> java.rmi.ServerException: EJBException:; nested exception is:
>
> javax.ejb.EJBException: checkSecurityAssociation;
> CausedByException is:
>
> Insufficient method permissions, principal=null,
> method=createPromotionProgram, interface=REMOTE,
> requiredRoles=[Administrator, SystemUser], principalRoles=[]
>
> …
>
>
>
> Although the account I used above (username=administrator,
> password=administrator, and its role is “Administrator”) is a valid
> account, when I use that account to login from my web server, and then
> call the method of the bean above, everything is OK. Please tell me what
> the problem is.
>
>
>
> Thanks and regards
>
> Quan
>
>
>
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user