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

omnigollum not handing off to omniauth? #64

Open
beporter opened this issue Feb 20, 2021 · 6 comments
Open

omnigollum not handing off to omniauth? #64

beporter opened this issue Feb 20, 2021 · 6 comments

Comments

@beporter
Copy link

I followed the setup for using zquestz/omniauth-google-oauth2 and put that into the omnigollum_options:

omnigollum_options = {
  providers: Proc.new do
    provider :google_oauth2, ENV['GOOGLE_CLIENT_ID'], ENV['GOOGLE_CLIENT_SECRET']
  end,
  dummy_auth: false,
}

but when trying to access a protected route, I get bounced to /__omnigollum__/auth/google_oauth2?origin=%2F, which 404's with no errors in the console.

I'm not sure if this is a version thing with sinatra or some other component, but digging into the code, this part seems... wrong? https://github.com/arr2036/omnigollum/blob/4c098d2/lib/omnigollum.rb#L310

      # Stop sinatra processing and hand off to omniauth
      app.before options[:route_prefix] + '/auth/:provider' do
        halt 404
      end

If the intent is to pass control back to OmniAuth, shouldn't this be pass or forward or call instead of halt?

@mcbloch
Copy link

mcbloch commented Feb 24, 2021

Having exactly the same issue here using the github provider. It goes to /__omnigollum__/auth/github?origin=%2F with the behavior as beporter explains..

@marius-hi
Copy link

I also experience the same issue with github provider, it redirects to /__omnigollum__/auth/github?origin=%2F

@yotarok
Copy link

yotarok commented Jun 15, 2021

I found this is due to the recent security fixes in OmniAuth that disabled GET access to "/auth/:provider".
We can workaround this by adding the following lines to the config file:

OmniAuth.config.allowed_request_methods = [:post, :get]

Though, this is not an optimal solution in terms of security.

After applying the above change, I could configure wiki to be invisible to unauthorized users, still I couldn't make it editable for authorized users (got "error updating page" message). I don't know if this is due to that my fix is incomplete.

@fhchl
Copy link

fhchl commented Oct 4, 2021

Same problem here with the Github provider.

@woodie
Copy link

woodie commented Oct 25, 2021

I got OAuth working with Gollum here:
https://github.com/woodie/gollum-wiki-oauth/

I'm going about this by configuring Nginx to do OAuth, and then swiping the email address from the headers.

goooooouwa added a commit to goooooouwa/knowledge-base that referenced this issue Mar 23, 2023
@goooooouwa
Copy link

goooooouwa commented Mar 23, 2023

any update on this issue? this issue basically makes omnigollum unusable since I'm not able to edit any pages.

michalhosna added a commit to michalhosna/mhdockerfiles that referenced this issue Feb 9, 2024
Omnigollum is broken: arr2036/omnigollum#64
Switched to supporting oauth2 proxy, use somthing like

    class Precious::App
      before do
        email = request.get_header("HTTP_X_FORWARDED_EMAIL")
        unless email
          halt 403, "Sorry, nothing for you here."
        end

        session["gollum.author"] = { name: email, email: email }
        @gollum_author_email = email
        @gollum_logout_link = "/oauth2/sign_out"
      end
    end
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

7 participants