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
bearer token proposal #373
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
I think going with the approach of FileTokenService to start makes sense.
ACK
| Other items to consider for consistency sake, but not directly required for this | ||
| proposal: | ||
|
|
||
| - Rename `UserServiceAdapter` to `UserService` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
docs/proposals/bearer-token.md
Outdated
| - Will this change APBs? | ||
|
|
||
| The bearer token will have no affect on the APBs. | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will there be any developer impact? Will bearer tokens be the default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll update the proposal to answer your question, but both basic and bearer will be enabled in catasb but for make run all auth is currently disabled.
docs/proposals/bearer-token.md
Outdated
|
|
||
| - How will the broker's behavior change? | ||
|
|
||
| The broker will now have 2 ways for authentication: basic auth and bearer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have two different ways to authenticate. Are these two independent code paths? In other words can you enable basic auth and use a bearer token?
Can you expand this question into an implementation section. A section## Broker Behavior is a good place to answer this question in detail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rthallisey yep, I can expand on it. You can have all the auths enabled if you want. Basically, the middleware handler will pick the first one that accepts the right authentication header. So if you have basic auth and bearer token enabled. And send in a Bearer token header, the basic auth provider will ignore it since there is no basic auth header. The bearer token provider will pick it up. If we had an SSL auth provider as well, it will have gotten skipped because the bearer token provider already processed the authentication.
docs/proposals/bearer-token.md
Outdated
| For example, I want to have a `BasicAuth` that uses the `FileUserService` and a | ||
| `BasicAuth` that uses `DBUserService`, a fictitious service that loads users from a | ||
| database. Today's configuration does not support specifying a service backend | ||
| to a particular `AuthProvider`. Thoughts? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like an expansion of existing auth. Does this belong here?
I'm trying to understand what's included as an AuthProvider. Is the existing auth an AuthProvider? Then I think the problem you're talking about here is the broker trying to figure out if a service backend is associated with either basic auth or a bearer token? Do I have that right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rthallisey Yes, BasicAuth is an AuthProvider. And AuthProvider can be associated with some backend service adapter. Today BasicAuth is configured to use FileUserServiceAdapter. But conceivably I'd like to configure BasicAuth to use a database of users instead something called DBUserService. I'm not sure how to represent that in our configuration.
func createProvider(providerType string, log *logging.Logger) (Provider, error) {
switch strings.ToLower(providerType) {
case "basic":
log.Info("Configured for basic auth")
usa, err := GetUserServiceAdapter(log)
if err != nil {
return nil, err
}
return NewBasicAuth(usa, log), nil
// add case "oauth":
default:
panic("Unknown auth provider")
}
}
// GetUserServiceAdapter returns the configured UserServiceAdapter
func GetUserServiceAdapter(log *logging.Logger) (UserServiceAdapter, error) {
// TODO: really need to figure out a better way to define what
// should be returned.
return NewFileUserServiceAdapter("/var/run/asb-auth", log)
}I could extend the configuration to also include a key for the service backend to use:
auth:
- type: basic
backend: file
enabled: false
- type: basic
backend: db
enabled: trueOr if we want to support multiple basic auths something like this:
auth:
- type: basicfile
enabled: true
- type: basicdb
enabled: trueeach would be distinct keys in the list of supported values.
|
@rthallisey I updated the docs to clarify the questions section, and I tried to answer your question about AuthProvider. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
| `BasicAuth` that uses `DBUserService`, a fictitious service that loads users from a | ||
| database. Today's configuration does not support specifying a service backend | ||
| to a particular `AuthProvider`. Thoughts? | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a solution for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rthallisey not yet, right now basicauth is tied to FileUserService and bearer auth would be tied to FileTokenService. Just need to decide how we want this in the config file.
Add bearer token auth to the service broker.