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

Limiting Access to Client Credentials #196

Closed
huntsfromshadow opened this issue Nov 18, 2016 · 7 comments
Closed

Limiting Access to Client Credentials #196

huntsfromshadow opened this issue Nov 18, 2016 · 7 comments

Comments

@huntsfromshadow
Copy link

Currently a Client Credentials grant works
with password grant client and an authorization grant client.

In either case if the user sends in the correct client_secret and correct client_id to oauth/token the system
authorizes and returns a token.

I'm thinking it may be good to limit clients that can use the client_credential grant similar to how password grant works.

@themsaid
Copy link
Member

But endpoints protected by the client credentials grant may be accessible by anyone with access, they are public endpoints, so yes as long as you have a valid token you can access.

@huntsfromshadow
Copy link
Author

Aren't all end points protected by all grants? Maybe I'm not understanding
something correctly.

Right now I have endpoints that use the middleware auth:api.
The endpoint works fine with the password client. Will it not work correctly to the client_credentials grant?

@themsaid
Copy link
Member

The client credentials grant has no user attached, it just gives access to a client for specific endpoints. Think of an endpoint that returns the countries a user can register from, by the time you need this endpoint there's no user object, only a client.

@huntsfromshadow
Copy link
Author

Okay that makes sense.
How do you set endpoints then to use client credential?

Our use case here. We have a secure server to server connection that needs to send commands to this api. These commands are not tied to a specific user (as the caller will be sending commands on behalf of all users).

@craigpaul
Copy link

craigpaul commented Nov 18, 2016

@huntsfromshadow instead of securing your endpoint with the auth:api middleware, you can use the simplified one here (CheckClientCredentials). Passport doesn't register middleware in its service provider so you will have to put it in your Kernel file, but that middleware basically authorizes a token but doesn't require a user to be attached.

@huntsfromshadow
Copy link
Author

Thanks.

@amsanket22
Copy link

but it allows password token as well, I just want to provide access to client credential grant based tokens

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

No branches or pull requests

4 participants