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

Don't init oauth if settings have it disabled #31533

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

techknowlogick
Copy link
Member

Fix #30266

Patch credit to: @hawicz

@techknowlogick techknowlogick added the backport/v1.22 This PR should be backported to Gitea 1.22 label Jul 1, 2024
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 1, 2024
@pull-request-size pull-request-size bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jul 1, 2024
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Jul 1, 2024
…is it is possible to have suprious jwt/ directories all over the place
@@ -30,6 +30,11 @@ const ProviderHeaderKey = "gitea-oauth2-provider"

// Init initializes the oauth source
func Init(ctx context.Context) error {
// if oauth is disabled, we don't need to initialize anything
if !setting.OAuth2.Enable {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the CI, this should be called

Suggested change
if !setting.OAuth2.Enable {
if !setting.OAuth2.Enabled {

@@ -30,6 +30,11 @@ const ProviderHeaderKey = "gitea-oauth2-provider"

// Init initializes the oauth source
func Init(ctx context.Context) error {
// if oauth is disabled, we don't need to initialize anything
if !setting.OAuth2.Enable {
return
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return
return nil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/v1.22 This PR should be backported to Gitea 1.22 lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/go Pull requests that update Go code size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

loadOrCreateAsymmetricKey called when oauth2 is disabled
3 participants