Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EnableOAuth - hidden context.Background #1303

Open
mfreeman451 opened this issue Dec 13, 2024 · 1 comment
Open

EnableOAuth - hidden context.Background #1303

mfreeman451 opened this issue Dec 13, 2024 · 1 comment

Comments

@mfreeman451
Copy link
Contributor

Describe the bug
EnableOAuth needs to be updated to take a context and eventually pass it down to updateKeys().

func updateKeys(config OauthConfigs) (*PublicKeys, error) {
	resp, err := config.Provider.GetWithHeaders(context.Background(), "", nil, nil)
	if err != nil || resp == nil {
		return nil, err
	}

	body, err := io.ReadAll(resp.Body)
	if err != nil {
		return nil, err
	}

	resp.Body.Close()

	var keys JWKS

	err = json.Unmarshal(body, &keys)
	if err != nil {
		return nil, err
	}

	var publicKeys PublicKeys
	publicKeys.keys = make(map[string]*rsa.PublicKey)

	publicKeys.keys = publicKeyFromJWKS(keys)

	return &publicKeys, nil
}

To Reproduce
Steps to reproduce the behavior, if applicable:

  1. The code is

  2. The error is

    
    

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environments (please complete the following information):

  • OS: [e.g. Linux]
  • gofr version [e.g. v1.5.0]
  • go version [e.g. 1.21]

More description
Add any other context about the problem here.

@Umang01-hash
Copy link
Contributor

Hi @mfreeman451, thank you for raising this issue.

While your description outlines the change that needs to be made, it would be helpful to understand the context and impact more clearly. Could you please update the issue description to include why this update is necessary and what problems it addresses if not implemented? This will help us better understand and prioritize the change.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants