mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-02-27 16:29:38 -06:00
Fix nil pointer exception in webfinger
Co-authoredjby: Jörn Dreyer <jdreyer@owncloud.com> Signed-off-by: Christian Richter <crichter@owncloud.com>
This commit is contained in:
@@ -39,7 +39,7 @@ func OidcAuth(opts ...Option) func(http.Handler) http.Handler {
|
||||
// it will fetch the keys from the issuer using the .well-known
|
||||
// endpoint
|
||||
return goidc.NewProvider(
|
||||
context.WithValue(context.Background(), oauth2.HTTPClient, http.Client{}),
|
||||
context.WithValue(context.Background(), oauth2.HTTPClient, &opt.HttpClient),
|
||||
opt.OidcIssuer,
|
||||
)
|
||||
}
|
||||
@@ -65,7 +65,7 @@ func OidcAuth(opts ...Option) func(http.Handler) http.Handler {
|
||||
}
|
||||
|
||||
userInfo, err := provider.UserInfo(
|
||||
context.WithValue(ctx, oauth2.HTTPClient, http.Client{}),
|
||||
context.WithValue(ctx, oauth2.HTTPClient, &opt.HttpClient),
|
||||
oauth2.StaticTokenSource(oauth2Token),
|
||||
)
|
||||
if err != nil {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
gatewayv1beta1 "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/log"
|
||||
)
|
||||
@@ -16,6 +18,8 @@ type Options struct {
|
||||
OidcIssuer string
|
||||
// GatewayAPIClient is a reva gateway client
|
||||
GatewayAPIClient gatewayv1beta1.GatewayAPIClient
|
||||
// HttpClient is a http client
|
||||
HttpClient http.Client
|
||||
}
|
||||
|
||||
// WithLogger provides a function to set the openid connect issuer option.
|
||||
@@ -38,3 +42,10 @@ func WithGatewayAPIClient(val gatewayv1beta1.GatewayAPIClient) Option {
|
||||
o.GatewayAPIClient = val
|
||||
}
|
||||
}
|
||||
|
||||
// HttpClient provides a function to set the http client option.
|
||||
func WithHttpClient(val http.Client) Option {
|
||||
return func(o *Options) {
|
||||
o.HttpClient = val
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user