Skip to content

Commit efeba25

Browse files
committed
changes from the review
Signed-off-by: Juraci Paixão Kröhling <[email protected]>
1 parent cbe2053 commit efeba25

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
change_type: 'enhancement'
2+
component: confighttp
3+
note: Add option to include query params in auth context
4+
issues: [4806]
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
change_type: 'enhancement'
1+
change_type: 'breaking'
22
component: confighttp
3-
note: Add option to include query params in auth context
3+
note: Auth data type signature has changed
4+
subtext: |
5+
As part of the linked PR, the `auth` attribute was moved from `configauth.Authentication`
6+
to a new `AuthConfig`, which contains a `configauth.Authentication`. For end-users, this
7+
is a non-breaking change. For users of the API, create a new AuthConfig using the
8+
`configauth.Authentication` instance that was being used before.
49
issues: [4806]
10+
change_logs: [api]

extension/auth/server.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ import (
1818
type Server interface {
1919
extension.Extension
2020

21-
// Authenticate checks whether the given headers map contains valid auth data. Successfully authenticated calls will always return a nil error.
21+
// Authenticate checks whether the given map contains valid auth data. Successfully authenticated calls will always return a nil error.
2222
// When the authentication fails, an error must be returned and the caller must not retry. This function is typically called from interceptors,
2323
// on behalf of receivers, but receivers can still call this directly if the usage of interceptors isn't suitable.
2424
// The deadline and cancellation given to this function must be respected, but note that authentication data has to be part of the map, not context.
2525
// The resulting context should contain the authentication data, such as the principal/username, group membership (if available), and the raw
2626
// authentication data (if possible). This will allow other components in the pipeline to make decisions based on that data, such as routing based
2727
// on tenancy as determined by the group membership, or passing through the authentication data to the next collector/backend.
2828
// The context keys to be used are not defined yet.
29-
Authenticate(ctx context.Context, headers map[string][]string) (context.Context, error)
29+
Authenticate(ctx context.Context, sources map[string][]string) (context.Context, error)
3030
}
3131

3232
type defaultServer struct {
@@ -39,14 +39,14 @@ type defaultServer struct {
3939
type ServerOption func(*defaultServer)
4040

4141
// ServerAuthenticateFunc defines the signature for the function responsible for performing the authentication based
42-
// on the given headers map. See Server.Authenticate.
43-
type ServerAuthenticateFunc func(ctx context.Context, headers map[string][]string) (context.Context, error)
42+
// on the given sources map. See Server.Authenticate.
43+
type ServerAuthenticateFunc func(ctx context.Context, sources map[string][]string) (context.Context, error)
4444

45-
func (f ServerAuthenticateFunc) Authenticate(ctx context.Context, headers map[string][]string) (context.Context, error) {
45+
func (f ServerAuthenticateFunc) Authenticate(ctx context.Context, sources map[string][]string) (context.Context, error) {
4646
if f == nil {
4747
return ctx, nil
4848
}
49-
return f(ctx, headers)
49+
return f(ctx, sources)
5050
}
5151

5252
// WithServerAuthenticate specifies which function to use to perform the authentication.

0 commit comments

Comments
 (0)