I'm trying to use an @PicketLinked class that extends the BaseAuthenticator.
My set-up is an ear project on wildfly 9.0.2.Final.
I'm using this in my jboss-deployment-structure.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<!-- This will enable PicketLink Authentication/Authorization and IDM dependencies to your deployment. -->
<module name="org.picketlink.core.api" meta-inf="import" annotations="true"/>
<module name="org.picketlink.core" meta-inf="import" annotations="true"/>
<module name="org.picketlink.idm.api" meta-inf="import" annotations="true"/>
<module name="org.picketlink.idm" meta-inf="import" annotations="true"/>
<module name="org.picketlink.common" meta-inf="import" annotations="true"/>
<module name="org.picketlink.idm.schema" meta-inf="import" annotations="true"/>
</dependencies>
</deployment>
<sub-deployment name="prestiz-web.war">
<dependencies>
<!-- This will enable PicketLink Authentication/Authorization and IDM dependencies to your deployment. -->
<module name="org.picketlink.core.api" meta-inf="import" annotations="true"/>
<module name="org.picketlink.core" meta-inf="import" annotations="true"/>
<module name="org.picketlink.idm.api" meta-inf="import" annotations="true"/>
<module name="org.picketlink.idm" meta-inf="import" annotations="true"/>
<module name="org.picketlink.common" meta-inf="import" annotations="true"/>
<module name="org.picketlink.idm.schema" meta-inf="import" annotations="true"/>
</dependencies>
</sub-deployment>
<sub-deployment name="prestiz-ejb.jar">
<dependencies>
<!-- This will enable PicketLink Authentication/Authorization and IDM dependencies to your deployment. -->
<module name="org.picketlink.core.api" meta-inf="import" annotations="true"/>
<module name="org.picketlink.core" meta-inf="import" annotations="true"/>
<module name="org.picketlink.idm.api" meta-inf="import" annotations="true"/>
<module name="org.picketlink.idm" meta-inf="import" annotations="true"/>
<module name="org.picketlink.common" meta-inf="import" annotations="true"/>
<module name="org.picketlink.idm.schema" meta-inf="import" annotations="true"/>
</dependencies>
</sub-deployment>
</jboss-deployment-structure>
My BaseAuthenticator class is declared as following within my ejb.jar
@RequestScoped
@PicketLink
public class PicketlinkAuthenticator extends BaseAuthenticator
My LoginController is configured as following:
@Path("/login")
public class LoginController {
@Inject
private Identity identity;
@Inject
private DefaultLoginCredentials credentials;
@GET
@Path("/dologin/{username}/{password}")
@Produces(MediaType.TEXT_PLAIN)
@Transactional(TxType.REQUIRED)
public String doLogin(@PathParam("username") String username, @PathParam("password") String password){
credentials.setUserId(username);
credentials.setPassword(password);
AuthenticationResult authResult=identity.login();
if(authResult.equals(AuthenticationResult.SUCCESS)){
return "success";
}else{
return "failed";
}
}
After identity.login() is called I see this in the logs:
11:49:09,630 INFO [org.picketlink.idm] (default task-2) PLIDM001000: Bootstrapping PicketLink IDM Partition Manager
11:49:09,667 INFO [org.picketlink.idm.identity.store] (default task-2) PLIDM001001: Initializing Identity Store [class org.picketlink.idm.file.internal.FileIdentityStore]
11:49:09,679 WARN [org.picketlink.idm.identity.store.file] (default task-2) PLIDM001101: Working directory [C:\Users\bgadeyne\AppData\Local\Temp\pl-idm] is marked to be always created. All your existing data will be lost.
11:49:09,688 INFO [org.picketlink.idm.identity.store.file] (default task-2) PLIDM001100: Using working directory [C:\Users\bgadeyne\AppData\Local\Temp\pl-idm].
The authenticate method of my authenticator has also some logging but this is not shown.
What am I missing here?
The solution is that you require a AuthenticatorSelector which will select your authenticator. This allows you to have multiple authenticators: