module OmniAuth
module Strategies
autoload :Bitbucket, Rails.root.join('lib', 'omniauth', 'strategies', 'bitbucket') - already there, not needed for us
autoload :Ourprovider, Rails.root.join('lib', 'omniauth', 'strategies', 'ourprovider') - added this line
end
end
Rails.application.config.middleware.use OmniAuth::Builder do
provider :ourprovider
end
module OmniAuth
module Strategies
class Ourprovider
include OmniAuth::Strategy
attr_reader :token
option :title, "IMAP Authentication"
option :fields, [:name, :email]
option :uid_field, [:name, :email]
def request_phase
File.open('/tmp/omniauth', 'a') { |file| file.write("request_phase (test)\n") }
OmniAuth::Form.build(
:title => "IMAP Authentication",
:url => callback_path
) do |f|
f.text_field 'Username', 'username'
f.password_field 'Password', 'password'
f.button "Login"
end.to_response
end
def callback_phase
File.open('/tmp/omniauth', 'a') { |file| file.write("callback_phase\n") }
#File.open('/tmp/omniauth', 'a') { |file| file.write("request: " + request.params.to_s + "\n") }
#File.open('/tmp/omniauth', 'a') { |file| file.write("username: " + request['username'].to_s + "\n") }
end
uid do
File.open('/tmp/omniauth', 'a') { |file| file.write("uid\n") }
end
info do
File.open('/tmp/omniauth', 'a') { |file| file.write("info\n") }
{
:nickname => request['username'],
}
end
end
end
end
If you have successfully set up a provider that is not shipped with GitLab itself, please let us know.
You can help others by reporting successful configurations and probably share a few insights or provide warnings for common errors or pitfalls by sharing your experience in the public Wiki.
The public Wiki has been deprecated (and all content removed), but if you git clone it from https://github.com/gitlabhq/gitlab-public-wiki.wiki.git and then check out commit 02db843614a1642c7101c721874d89b64a63d936 you can look at Custom-omniauth-provider-configurations.md
Sounds like you're blazing a trail here. Good luck!
Best,
Aleksey
--
You received this message because you are subscribed to the Google Groups "GitLab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gitlabhq+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gitlabhq/d130da93-4df7-4a4a-832a-bca1965c08fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.