user1004215
user1004215

Reputation:

Grails Custom Authentication Provider

I am trying to implement my own AuthenticationProvider in a grails project. I am using the grails spring security core plugin. However, I am having problem understanding how would I get the password from my grails domain class and compare it with the password passed in the argument in order to do the authentication. Any help would be greatly appreciated. Thank you.

Upvotes: 3

Views: 5497

Answers (2)

Burt Beckwith
Burt Beckwith

Reputation: 75671

I did a talk and blog post that included an example of a custom provider here: http://burtbeckwith.com/blog/?p=1090

Upvotes: 6

Hoàng Long
Hoàng Long

Reputation: 10848

As I understand, you are trying to use your own "User" domain class, with username, password,... and so on. Actually, we don't need to override AuthenticationProvider to do that. You can simply override UserDetailsService instead. All the things SpringSecurity needs is that you provide it with a UserDetails, it will do the password comparison for you, by the hash algorithm you specified in configuration.

For more details, you can refer here.

If it's not like I understand, please add some more code (what you achieve currently). A bit of code may help clear things out a lot.

Upvotes: 0

Related Questions