From c16b44d30bf73162334baa7f3ed481475a27517d Mon Sep 17 00:00:00 2001 From: Daniel Jiang Date: Tue, 7 May 2019 19:51:09 +0800 Subject: [PATCH] Make sure panic is not thrown when refresh token Fixes #7695 Signed-off-by: Daniel Jiang --- src/common/utils/oidc/helper.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/common/utils/oidc/helper.go b/src/common/utils/oidc/helper.go index cafb9852b..32fee3c29 100644 --- a/src/common/utils/oidc/helper.go +++ b/src/common/utils/oidc/helper.go @@ -208,5 +208,9 @@ func RefreshToken(ctx context.Context, token *Token) (*Token, error) { if err != nil { return nil, err } - return &Token{Token: *t, IDToken: t.Extra("id_token").(string)}, nil + it, ok := t.Extra("id_token").(string) + if !ok { + return nil, fmt.Errorf("failed to get id_token from refresh response") + } + return &Token{Token: *t, IDToken: it}, nil }