Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

[Question] - How do I implement custom authentication? #163

Open
anakinjay opened this issue Apr 27, 2016 · 5 comments
Open

[Question] - How do I implement custom authentication? #163

anakinjay opened this issue Apr 27, 2016 · 5 comments

Comments

@anakinjay
Copy link

Hey Guys,
Can someone please point me in the right direction for implementing custom authentication? We need Json Web Tokens for our route security.

I've been googling and pouring through the source code for days and can't seem to grasp it. Basically what I need is to create a custom authentication adapter where I can verify JWT signatures and allow or deny access to that end point based on the result. I've got all the JWT stuff handled, just need someone to point me in the right direction for creating a custom adapter.

Thanks guys!

@TomHAnderson
Copy link

I recommend using api-skeletons/zf-oauth2-doctrine for an OAuth2 adapter which supports JWT. The zfcampus/zf-oauth2 module has a JWT table but does not have a JTI table.

Because https://github.com/bshaffer/oauth2-server-php support JWT you shouldn't need a custom adapter.

@anakinjay
Copy link
Author

Hi Tom!
Thanks so much for your help with this. I tried looking over the oauth package you listed but boy it looks heavy. I admittedly am not very good with zend (that's why we wanted to use apigility to create stuff through the gui). Is there an easy way to just create an authentication adapter? Verifying a JWT token is literally 3 lines of code....

If not, I tried implementing your solution and ended up with a "Uncaught exception 'Zend\ServiceManager\Exception\ServiceNotCreatedException". Any chance for a more novice example, or a few key words I should be using in my searches?

Thanks again for the assistance!

@TomHAnderson
Copy link

Sorry, anakinjay, I'm really biased for api-skeletons/zf-oauth2-doctrine since I wrote it. I know it's the most complete OAuth2 implementation for Apigility.

I really think if you're using Apigility you should validate using OAuth2 and the JWT supported in OAuth2.

@anakinjay
Copy link
Author

haha that's totally fair :) I'd love to implement your framework, there just doesn't seem to be any newbie friendly instructions on how to do it.

@weierophinney
Copy link
Member

This repository has been closed and moved to laminas-api-tools/api-tools; a new issue has been opened at laminas-api-tools/api-tools#27.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants