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

How are you modeling authentication operation? #60

Open
schatekar opened this issue Dec 19, 2014 · 1 comment
Open

How are you modeling authentication operation? #60

schatekar opened this issue Dec 19, 2014 · 1 comment

Comments

@schatekar
Copy link

I am currently working on enhancing user service which would be consumed by several other services. Other than offering basic CRUD functionality around users this service is also supposed to act as a SAML enabled id provider and so it needs to be able to authenticate users somehow. The current implementation looks like below

PUT /authenticate

{
Userame: {username},
Passowrd: {password}
}

This returns a true or false depending on success or failure of authentication. I am thinking of changing this to be more RESTful. I am thinking on these lines.

Authentication is a process so there is real resource involved here. Should I define a new virtual resource? What should this resource be? Something that gets created when authentication succeeds? A LoggedInSession? A SecurityContext? SecurityContext sounds better. So let's design the API as below

POST /securitycontext

{
Userame: {username},
Passowrd: {password}
}

Not sure if I am thinking in the right direction.

@geemus
Copy link
Member

geemus commented Dec 22, 2014

It depends a lot on how your authentication works. ie, in many cases it makes sense to just pass auth in the Authorization header (using basic or token auth perhaps). SAML is a special case though, and one (I must warn you) I am not very familiar with. I read the wikipedia page a bit to give myself a rough idea, and given that I would say something like POST /security-contexts would probably make a lot of sense. I'd just note two small differences from what you suggested: 1) plural spelling of context and 2) dasherize the space between the two words. Both of those are just to follow existing conventions. Although singular spelling might make since if this is a singleton (as I suspect it might be), ie if each user would only ever have a single valid context. That said, I think just always using plurals can be nice for the sake of consistency also. Hope that helps, but happy to discuss further as needed. Thanks!

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

2 participants