java - JAAS via WildFly -


i want use jaas-authentication in java application via wildfly (8.2.0).

i have tried several methods , configurations....but still errors @ login (logincontext).

i have started configure standalone.xml (wildfly):

  • created new security realm „tprealm“ jaas-authentication:

    <security-realm name="tprealm">      <authentication>          <jaas name="tplogin"/>      </authentication> </security-realm> 
  • set realm default?:

    <subsystem xmlns="urn:jboss:domain:remoting:2.0">      <endpoint worker="default"/>         <http-connector name="http-remoting-connector" connector-ref="default" security-realm="tprealm"/> </subsystem> 
  • at last, have created security domain „tplogin“ login module:

    <security-domain name="tplogin" cache-type="default">     <authentication>         <login-module code="database" flag="required">             <module-option name="dsjndiname" value="java:jboss/datasources/tourplanningds"/>             <module-option name="principalsquery" value="select passwordhash tauser login=?"/>         </login-module>     </authentication> <security-domain> 

in java:

string username = "admin"; string password = "admin";  passwordclientcallbackhandler handler = new passwordclientcallbackhandler(username, "tprealm", password.tochararray());  try {       logincontext logincontext = new logincontext("tprealm", handler);       logincontext.login(); } catch (loginexception e) {       system.out.println("login failed");       return; } 

at "new logincontext(...)", following error

javax.security.auth.login.loginexception: no loginmodules configured tprealm 

moreoften read, config-file needed (jaas.config):

tprealm {       org.jboss.security.auth.spi.tplogin required;  // dont know, have stay here } 

i added file system.properties.

system.setproperty("java.security.auth.login.config", jaasconfig)  //jaasconfig = path file 

with this, can compile "new logincontext(...)" compiling failes @ next line @ logincontext.login():

javax.security.auth.login.loginexception: unable find loginmodule class: org.jboss.security.auth.spi.tplogin 

i watched log of wildfly expecting logged while running code, nothing logged.

in java application have added these properties:

properties ejbprops = new properties(); ejbprops.put("endpoint.name", "client-endpoint"); ejbprops.put("remote.connectionprovider.create.options.org.xnio.options.ssl_enabled", "false"); ejbprops.put("remote.connections", "default"); ejbprops.put("remote.connection.default.host", "localhost"); ejbprops.put("remote.connection.default.port", "8080");                                                   ejbprops.put("remote.connection.default.connect.options.org.xnio.options.sasl_policy_noanonymous", "false");  ejbclientconfiguration cc = new propertiesbasedejbclientconfiguration(ejbprops); contextselector<ejbclientcontext> selector = new configbasedejbclientcontextselector(cc); ejbclientcontext.setselector(selector); 

do need set further properties? should take notice on else?

i pleased, if me.