Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

authenticate only certain routes #75

Open
jonshutt opened this issue Jan 13, 2017 · 1 comment
Open

authenticate only certain routes #75

jonshutt opened this issue Jan 13, 2017 · 1 comment
Labels

Comments

@jonshutt
Copy link

Hello,

I'm using the authentication and login stuff, which is working fine. However, I need one route to be open to anyone, not just logged in members.

`Member:
extensions:
- RESTfulAPI_TokenAuthExtension

RESTfulAPI:
authentication_policy: true
access_control_policy: 'ACL_CHECK_CONFIG_AND_MODEL'
dependencies:
authenticator: '%$RESTfulAPI_TokenAuthenticator'
cors:
Enabled: true
Allow-Origin: ''
Allow-Headers: '
'
Allow-Methods: 'GET,POST'
Max-Age: 86400
RESTfulAPI_TokenAuthenticator:
tokenOwnerClass: 'Member'

Mountain:
api_access: 'GET'

Log:
api_access: 'GET,POST'`

I'd like the 'Log' dataobject to require the authentication, but the 'mountain' dataobject should be open to everyone.

Is this possible?

@colymba
Copy link
Owner

colymba commented Feb 1, 2017

Hey @jonshutt sorry for leaving you hanging with no answer...

Right now this is not possible with just a straight forward config. To get one API route with Auth and another without or just for some models, I see 2 solutions:

  1. Extend RESTfulAPI to something like OpenRESTfulAPI and disable Auth on its config. Then add a director route with something like 'openapi': 'OpenRESTfulAPI'
  2. Or extend RESTfulAPI_TokenAuthExtension and override authenticate to always return true for certain models

Extending RESTfulAPI might cleaner in the end, if you are ok to have 2 different api routes.

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

No branches or pull requests

2 participants