This is a container information, what do you try to achieve globally? Seems
you use a lot of internals.

You should be able to read it from our info tree or tomcat model in
StandardContext - surely the easiest.
Le 17 nov. 2015 05:17, "ereshgorantla" <[email protected]> a écrit :

> HI ,
> I am trying to set custom realm name to my application . I went through
> tomee documentation and realm-name is under login-config schema .
>
> securityfilter-config has login-config as like this .
> <securityfilter-config>
>     <login-config>
>         <realm-name>test for security</realm-name>
>         <auth-method>FORM</auth-method>
>         <form-login-config>
>             <form-login-page>/index.jsp</form-login-page>
>
> <form-error-page>/errors/not_authenticated.jsp</form-error-page>
>             <form-default-page>/index.jsp</form-default-page>
>         </form-login-config>
>      </login-config>
>      <realm class="anything"/>
> </securityfilter-config>
>
> Now I tried to get the realm name in the application . I tried this way. I
> passed realm name as "test for security" . Instead I got realm name as
> Tomee-security which happens to be my sample application name.
>
> private Realm findRealm(final String realmName) {
>         final TomcatWebAppBuilder webAppBuilder =
> SystemInstance.get().getComponent(TomcatWebAppBuilder.class);
>         if (webAppBuilder != null) {
>             final Realm r = webAppBuilder.getRealms().get('/' + realmName);
>             if (r != null) {
>                 return r;
>             }
>         }
>         return null;
> }
>
> Could you please help me how to find realm-name programmatically which is
> configured and similarly a way to find default realm with in servlets of an
> application.
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Setting-Realm-name-for-Tomee-application-tp4676811.html
> Sent from the TomEE Dev mailing list archive at Nabble.com.
>

Reply via email to