From 874b0b1c0cee1454bbd87c2eb7698320bf08e0b0 Mon Sep 17 00:00:00 2001 From: Thomas Rosenstein Date: Tue, 22 Sep 2020 10:06:39 +0200 Subject: [PATCH] fix #10913: initialize provider before calling Load Signed-off-by: Thomas Rosenstein --- src/common/utils/oidc/helper.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/common/utils/oidc/helper.go b/src/common/utils/oidc/helper.go index 1b4981156..228376dab 100644 --- a/src/common/utils/oidc/helper.go +++ b/src/common/utils/oidc/helper.go @@ -241,6 +241,11 @@ func refreshToken(ctx context.Context, token *Token) (*Token, error) { // UserInfoFromToken tries to call the UserInfo endpoint of the OIDC provider, and consolidate with ID token // to generate a UserInfo object, if the ID token is not in the input token struct, some attributes will be empty func UserInfoFromToken(ctx context.Context, token *Token) (*UserInfo, error) { + // #10913: preload the configuration, in case it was not previously loaded by the UI + _, err := provider.get() + if err != nil { + return nil, err + } setting := provider.setting.Load().(models.OIDCSetting) local, err := userInfoFromIDToken(ctx, token, setting) if err != nil {