geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sanjay kumar <sanjaykumar2891...@gmail.com>
Subject Re: Security Realm in Geronimo 2.2
Date Thu, 30 Dec 2010 10:08:39 GMT
HI all,
   I have written my security realm in geronimo 2.2. when i try to use this
gives an error . the error console and code is given below:
my code:-------------------------
-
package test;

import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.security.auth.login.LoginContext;

import com.viithiisys.mdf.admin.user.UserManager;


public class Test {
    private static UserManager t;
    private static Object obj;
    //private static InitialContext icontext;

    public static void main(String[] args)  {

        try {

            Properties props = new Properties();

props.put("java.naming.factory.initial","org.apache.openejb.client.RemoteInitialContextFactory");

            props.put("java.naming.provider.url", "127.0.0.1:4201");
            //props.put("java.naming.provider.url", "localhost:61616");
            props.put("java.naming.security.principal", "abhinav");
            props.put("java.naming.security.credentials", "ofbiz");
            System.out.println("user name and password supplied
.............");
            props.setProperty("openejb.authentication.realmName",
"eadmin-security-realm");
            Context icontext=new InitialContext(props);
            System.out.println("initail context loaded and about to lookup
EJB .............");
            obj = icontext.lookup("UserManagerImplRemote");
//            t = (UserManager)
PortableRemoteObject.narrow(obj,UserManager.class);
            t = (UserManager)obj;
            System.out.println("calling method create............." + t);
        try{
            t.create("Sanju", "test123", "10080", "Sanju", "Heer",
"0172-2565656", "sanjay@kumar.com", 30);
            //t.createRole("Sanjay", "TestRole");
            System.out.println("done successfully.................");
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
        } catch (Exception e) {
            e.printStackTrace();
        }


    }
}




the error stack trace is given below:------------


user name and password supplied .............
javax.naming.AuthenticationException: This principle is not authorized.
[Root exception is javax.security.auth.login.LoginException: No LoginModules
configured for eadmin-security-realm]
    at
org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:173)
    at
org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:114)
    at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
    at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
    at javax.naming.InitialContext.init(InitialContext.java:223)
    at javax.naming.InitialContext.<init>(InitialContext.java:197)
    at test.Test.main(Test.java:114)
Caused by: javax.security.auth.login.LoginException: No LoginModules
configured for eadmin-security-realm
    at javax.security.auth.login.LoginContext.init(LoginContext.java:256)
    at javax.security.auth.login.LoginContext.<init>(LoginContext.java:499)
    at
org.apache.geronimo.security.ContextManager.login(ContextManager.java:92)
    at
org.apache.geronimo.security.ContextManager.login(ContextManager.java:108)
    at
org.apache.geronimo.openejb.GeronimoSecurityService.login(GeronimoSecurityService.java:53)
    at
org.apache.openejb.server.ejbd.AuthRequestHandler.processRequest(AuthRequestHandler.java:56)
    at
org.apache.openejb.server.ejbd.EjbDaemon.processAuthRequest(EjbDaemon.java:204)
    at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:157)
    at org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:71)
    at
org.apache.openejb.server.ejbd.KeepAliveServer$Session.service(KeepAliveServer.java:213)
    at
org.apache.openejb.server.ejbd.KeepAliveServer.service(KeepAliveServer.java:233)
    at org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:66)
    at org.apache.openejb.server.ServicePool$2.run(ServicePool.java:91)
    at org.apache.openejb.server.ServicePool$3.run(ServicePool.java:120)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)


On Thu, Dec 30, 2010 at 12:09 AM, David Jencks <david_jencks@yahoo.com>wrote:

> I wonder if you have the global attribute configured correctly in your
> security realm?  I just added a little bit of documentation on it since I
> couldn't find any:
>
>
> https://cwiki.apache.org/confluence/display/GMOxDOC22/Configuring+login+modules
>
> thanks
> david jencks
>
> On Dec 29, 2010, at 5:14 AM, sanjay kumar wrote:
>
> HI all,
>    I have written my security realm in geronimo 2.2. when i try to use this
> gives an error . the error console and code is given below:
> my code:--------------------------
> package test;
>
> import java.util.Properties;
>
> import javax.naming.Context;
> import javax.naming.InitialContext;
> import javax.security.auth.login.LoginContext;
>
> import com.viithiisys.mdf.admin.user.UserManager;
>
>
> public class Test {
>     private static UserManager t;
>     private static Object obj;
>     //private static InitialContext icontext;
>
>     public static void main(String[] args)  {
>
>         try {
>
>             Properties props = new Properties();
>
> props.put("java.naming.factory.initial","org.apache.openejb.client.RemoteInitialContextFactory");
>
>             props.put("java.naming.provider.url", "127.0.0.1:4201");
>             //props.put("java.naming.provider.url", "localhost:61616");
>             props.put("java.naming.security.principal", "abhinav");
>             props.put("java.naming.security.credentials", "ofbiz");
>             System.out.println("user name and password supplied
> .............");
>             props.setProperty("openejb.authentication.realmName",
> "eadmin-security-realm");
>             Context icontext=new InitialContext(props);
>             System.out.println("initail context loaded and about to lookup
> EJB .............");
>             obj = icontext.lookup("UserManagerImplRemote");
> //            t = (UserManager)
> PortableRemoteObject.narrow(obj,UserManager.class);
>             t = (UserManager)obj;
>             System.out.println("calling method create............." + t);
>         try{
>             t.create("Sanju", "test123", "10080", "Sanju", "Heer",
> "0172-2565656", "sanjay@kumar.com", 30);
>             //t.createRole("Sanjay", "TestRole");
>             System.out.println("done successfully.................");
>         }
>         catch(Exception e)
>         {
>             e.printStackTrace();
>         }
>         } catch (Exception e) {
>             e.printStackTrace();
>         }
>
>
>     }
> }
>
>
>
>
> the error stack trace is given below:------------
>
>
> user name and password supplied .............
> javax.naming.AuthenticationException: This principle is not authorized.
> [Root exception is javax.security.auth.login.LoginException: No LoginModules
> configured for eadmin-security-realm]
>     at
> org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:173)
>     at
> org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:114)
>     at
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>     at
> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>     at javax.naming.InitialContext.init(InitialContext.java:223)
>     at javax.naming.InitialContext.<init>(InitialContext.java:197)
>     at test.Test.main(Test.java:114)
> Caused by: javax.security.auth.login.LoginException: No LoginModules
> configured for eadmin-security-realm
>     at javax.security.auth.login.LoginContext.init(LoginContext.java:256)
>     at javax.security.auth.login.LoginContext.<init>(LoginContext.java:499)
>     at
> org.apache.geronimo.security.ContextManager.login(ContextManager.java:92)
>     at
> org.apache.geronimo.security.ContextManager.login(ContextManager.java:108)
>     at
> org.apache.geronimo.openejb.GeronimoSecurityService.login(GeronimoSecurityService.java:53)
>     at
> org.apache.openejb.server.ejbd.AuthRequestHandler.processRequest(AuthRequestHandler.java:56)
>     at
> org.apache.openejb.server.ejbd.EjbDaemon.processAuthRequest(EjbDaemon.java:204)
>     at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:157)
>     at org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:71)
>     at
> org.apache.openejb.server.ejbd.KeepAliveServer$Session.service(KeepAliveServer.java:213)
>     at
> org.apache.openejb.server.ejbd.KeepAliveServer.service(KeepAliveServer.java:233)
>     at org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:66)
>     at org.apache.openejb.server.ServicePool$2.run(ServicePool.java:91)
>     at org.apache.openejb.server.ServicePool$3.run(ServicePool.java:120)
>     at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>     at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>     at java.lang.Thread.run(Thread.java:619)
>
>
> --
> Regards:
> Sanjay Kumar
> sanjaykumar2891987@gmail.com
> Java Developer
>
>
>
>


-- 
Regards:
Sanjay Kumar
sanjaykumar2891987@gmail.com
Java Developer

Mime
View raw message