Skip to content

Commit 3226126

Browse files
committed
Allow the app-auth announce www-authenticate: basic header.
1 parent d2e8fcb commit 3226126

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

changelog/unreleased/fix-app-auth.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Bugfix: Fix app-auth
2+
3+
Allow the app-auth announce `www-authenticate: basic` header.
4+
5+
https://github.com/owncloud/ocis/pull/11123
6+
https://github.com/owncloud/ocis/issues/11113

services/proxy/pkg/command/server.go

+1
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ func loadMiddlewares(logger log.Logger, cfg *config.Config,
353353
middleware.Logger(logger),
354354
middleware.OIDCIss(cfg.OIDC.Issuer),
355355
middleware.EnableBasicAuth(cfg.EnableBasicAuth),
356+
middleware.AllowAppAuth(cfg.AuthMiddleware.AllowAppAuth),
356357
middleware.TraceProvider(traceProvider),
357358
),
358359
middleware.AccountResolver(

services/proxy/pkg/middleware/authentication.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ func configureSupportedChallenges(options Options) {
146146
SupportedAuthStrategies = append(SupportedAuthStrategies, "bearer")
147147
}
148148

149-
if options.EnableBasicAuth {
149+
if options.EnableBasicAuth || options.AllowAppAuth {
150150
SupportedAuthStrategies = append(SupportedAuthStrategies, "basic")
151151
}
152152
}

services/proxy/pkg/middleware/options.go

+9
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ type Options struct {
5353
AutoprovisionAccounts bool
5454
// EnableBasicAuth to allow basic auth
5555
EnableBasicAuth bool
56+
// AllowAppAuth specifies whether authentication using application tokens is permitted.
57+
AllowAppAuth bool
5658
// DefaultAccessTokenTTL is used to calculate the expiration when an access token has no expiration set
5759
DefaultAccessTokenTTL time.Duration
5860
// UserInfoCache sets the access token cache store
@@ -183,6 +185,13 @@ func EnableBasicAuth(enableBasicAuth bool) Option {
183185
}
184186
}
185187

188+
// AllowAppAuth provides a function to set the AllowAppAuth config
189+
func AllowAppAuth(allowAppAuth bool) Option {
190+
return func(o *Options) {
191+
o.AllowAppAuth = allowAppAuth
192+
}
193+
}
194+
186195
// DefaultAccessTokenTTL provides a function to set the DefaultAccessTokenTTL
187196
func DefaultAccessTokenTTL(ttl time.Duration) Option {
188197
return func(o *Options) {

0 commit comments

Comments
 (0)