Hmm

Let step back

Realm#getName is the realm instance name. It is a name for tomcat. You get
https://github.com/apache/tomee/blob/master/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java#L395

The realm name feom web.xml is the LoginConfig one
https://github.com/apache/tomcat/blob/3c8b971d9b6fe48149ea4c483436615a1920c47a/java/org/apache/tomcat/util/descriptor/web/LoginConfig.java#L128
Le 18 nov. 2015 04:53, "ereshgorantla" <[email protected]> a écrit :

> Thanks Romain
> I tried to get realmName from StandardContext and got the realm name as
> /tomee which is not my project name . I am in an assumption that Tomee will
> create application's web context as its realm name . Correct me If I am
> wrong . If it is correct . I has to get realm name as /<my-project> not
> /tomee which is tomee manager app.
>
> Mean while I found a way to login to tomeewebapp so that ejb context will
> bind username at their context.
> For that I need to send Principal and Realm as null only runAs argument is
> passed to  Even though we pass realm and principal as null security service
> will create subject and adds the login user in to stack.
>
> TomcatSecurityService ss = (TomcatSecurityService)
> SystemInstance.get().getComponent(SecurityService.class);
>  //ss.enterWebApp(null, null, login); // realm and principal are sending as
> null as Realm is hard coded
>  ss.enterWebApp(realm, principal, login);
>
> My question is why I am getting realmName as /tomee instead of
> /<my-project>
> . Please reply to me .
> For your reference I had created a sample maven project which I will be
> using to implement security . If you have Time please go through .
>
> sample project code : security.zip
> <http://tomee-openejb.979440.n4.nabble.com/file/n4676835/security.zip>
>
> Thanks
>
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Setting-Realm-name-for-Tomee-application-tp4676811p4676835.html
> Sent from the TomEE Dev mailing list archive at Nabble.com.
>

Reply via email to