{"action":"created","issue":{"url":"https://api.github.com/repos/pac4j/pac4j/issues/777","repository_url":"https://api.github.com/repos/pac4j/pac4j","labels_url":"https://api.github.com/repos/pac4j/pac4j/issues/777/labels{/name}","comments_url":"https://api.github.com/repos/pac4j/pac4j/issues/777/comments","events_url":"https://api.github.com/repos/pac4j/pac4j/issues/777/events","html_url":"https://github.com/pac4j/pac4j/issues/777","id":196358660,"number":777,"title":"Refactor database-based authenticators?","user":{"login":"victornoel","id":160975,"avatar_url":"https://avatars.githubusercontent.com/u/160975?v=3","gravatar_id":"","url":"https://api.github.com/users/victornoel","html_url":"https://github.com/victornoel","followers_url":"https://api.github.com/users/victornoel/followers","following_url":"https://api.github.com/users/victornoel/following{/other_user}","gists_url":"https://api.github.com/users/victornoel/gists{/gist_id}","starred_url":"https://api.github.com/users/victornoel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/victornoel/subscriptions","organizations_url":"https://api.github.com/users/victornoel/orgs","repos_url":"https://api.github.com/users/victornoel/repos","events_url":"https://api.github.com/users/victornoel/events{/privacy}","received_events_url":"https://api.github.com/users/victornoel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-12-19T08:43:37Z","updated_at":"2016-12-21T09:43:58Z","closed_at":null,"body":"Hi,\r\n\r\n@wardr implemented its own `DbAuthenticator` (see [this discussion](https://groups.google.com/d/msg/pac4j-users/F3B1FBFvumg/QO1pn_h7DwAJ) on the mailing list) and reading the code, I was wondering if it wouldn't make sense to rebase pac4j's `MongoAuthenticator` and `DbAuthenticator` on top of something similar (he implemented his own password encoder, but that would of course be replaced by pac4j's).\r\n\r\nThe justification would be that both `MongoAuthenticator` and `DbAuthenticator` are two different ways of querying a database, and there is some duplication between the two of them.\r\nIn past I already tried to factor some code in the `MongoAuthenticator` because I wanted to use another library than the official mongo implementation. I think this is in the same vein, but more generic.\r\nWe would provide some implementations for mongo and jdbc like we currently do, and we could then let people subclass it and focus on their database needs without bothering with the common functionalities (see for example a [subclassing](https://github.com/wardr/dropwizard-pac4j-demo/blob/master/src/main/java/com/uberlogik/demo/security/JooqAuthenticator.java) of @wardr implementation).\r\n\r\nWDYT @leleuj? :)"},"comment":{"url":"https://api.github.com/repos/pac4j/pac4j/issues/comments/268479433","html_url":"https://github.com/pac4j/pac4j/issues/777#issuecomment-268479433","issue_url":"https://api.github.com/repos/pac4j/pac4j/issues/777","id":268479433,"user":{"login":"leleuj","id":1038508,"avatar_url":"https://avatars.githubusercontent.com/u/1038508?v=3","gravatar_id":"","url":"https://api.github.com/users/leleuj","html_url":"https://github.com/leleuj","followers_url":"https://api.github.com/users/leleuj/followers","following_url":"https://api.github.com/users/leleuj/following{/other_user}","gists_url":"https://api.github.com/users/leleuj/gists{/gist_id}","starred_url":"https://api.github.com/users/leleuj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leleuj/subscriptions","organizations_url":"https://api.github.com/users/leleuj/orgs","repos_url":"https://api.github.com/users/leleuj/repos","events_url":"https://api.github.com/users/leleuj/events{/privacy}","received_events_url":"https://api.github.com/users/leleuj/received_events","type":"User","site_admin":false},"created_at":"2016-12-21T09:43:58Z","updated_at":"2016-12-21T09:43:58Z","body":"I'm not sure to follow you, but maybe there is more to share between both authenticators than between the `MongoProfileService` and the `MongoAuthenticator` for example.\r\nThat said, these are fairly small classes so I don't think we should create a too complicated class hierarchy just to share a few methods.\r\n\r\nA pull request would help getting a better vision of what we can do...\r\n"}}
{"actor":{"display_login":"leleuj"}}