2

=== Update 20190327 ===

Thanks for the comments but the demo didn't help much. After digging into the source code I got a better understanding of the framework.

What I need is

  • A custom Client that extends the BasicClient so that a custom CredentialsExtractor can be feed into the framework. (Since my user access token cannot be extracted with the ParameterClient)
  • A custom CredentialsExtractor that implements CredentialsExtractor which you pass into the framework in the custom client(override clientInit method).
  • Finally, a custom authenticator which is passed into the custom client.

This worked out for me.

=== Original ===

I have an existing play 2.6 application. I'm integrating pac4j and trying to make authentication work. The play server provides REST api. If I understand correctly, what I need is an http client with sql authenticator.

http://www.pac4j.org/3.3.x/docs/authenticators/sql.html

As stated in the doc, DbProfileService is needed. but it assumes a particular users table scheme which wouldn't work with the existing db.

So I suppose I need to implement an custom authenticator. But I couldn't find any useful example on the web.

So could anyone enlighten me or am I on the wrong way to do this work?

h--n
  • 5,903
  • 4
  • 31
  • 32
  • Here is the dummy example https://github.com/pac4j/play-pac4j-java-demo/blob/master/app/modules/SecurityModule.java#L157 but it shows the way – Andriy Kuba Mar 14 '19 at 11:07
  • @AndriyKuba Thanks for the comment. I got authentication work. Now I'm trying to make authorization work. Is there things like \@RequiresRoles that pac4j provides. I couldn't find it. – h--n Mar 18 '19 at 11:16
  • check the same demo project - https://github.com/pac4j/play-pac4j-java-demo/blob/master/app/controllers/Application.java#L71 – Andriy Kuba Mar 18 '19 at 21:20

0 Answers0