Create a security realm in Wildfly
You need a file jboss-web.xml
in WEB-INF
to override the default other
domain. For instance:
<jboss-web>
<security-domain>java:/jaas/mydomain</security-domain>
</jboss-web>
Then in the Wildfly config file (standalone.xml
or the likes) you configure the mydomain
Security Domain like you already showed. It can happily co-exist with the already present other
domain.
There's an excellent post here: http://blog.eisele.net/2015/01/jdbc-realm-wildfly820-primefaces51.html
Francesco
Code lover, pretty curios and sometimes absent minded programmer.
Updated on June 08, 2022Comments
-
Francesco almost 2 years
I want to secure some ejb hosted on my Widlfly AS, so I start creating my security-domain. I don't want to authenticate on ApplicationRealm so I define my security-realm and point it in my security-domain. I want to store credentials in a text file. Here is the code:
<security-domain name="mydomain" cache-type="default"> <authentication> <login-module code="RealmDirect" flag="required"/> <module-option name="realm" value="myrealm"/> <module-option name="userProperties" value="${jboss.server.config.dir}/myrealm-users.properties"/> <module-option name="rolesProperties" value="${jboss.server.config.dir}/myrealm-roles.properties"/> </authentication> </security-domain>
still it look like my ejb are affected by ApplicationRealm by the "other" security-domain. Can I define a custom security realm and use it by security-domain in Wildfly? If yes how can I add users to it?
-
Francesco about 9 yearsHello. You're right, I think that's because EJB's inherits WEB security domain. But what if I got EJBs in a .jar?
-
geert3 about 9 yearsIf they are in a
.jar
it would likely be more straightforward then if they're in an.ear
. So I'd say just try it, likely it'll just work.