This repository has been archived by the owner on May 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 56
Fixed logout #24
Open
acosonic
wants to merge
6
commits into
chrodriguez:master
Choose a base branch
from
acosonic:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Fixed logout #24
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
48d351c
Fixed logout
5ce5b0d
OneLogin fixes
3c839e2
OneLogin fixes
acosonic ac52b3b
OneLogin fixes route and string
acosonic f32559a
Added sample onelogin initializer and updated Readme
acosonic f46e8e3
routes fix, due to windows post errors
acosonic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
RedmineApp::Application.routes.draw do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file should not be included |
||
match '/auth/failure' => 'account#login_with_saml_failure', via: [:get, :post] | ||
match '/auth/:provider/callback' => 'account#login_with_saml_callback', via: [:get, :post] | ||
match '/auth/:provider' => 'account#login_with_saml_redirect', as: :sign_in, via: [:get, :post] | ||
match '/auth/:provider/consume' => 'account#login_with_saml_redirect', as: :sign_in, via: [:get, :post] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,14 +5,18 @@ class User | |
|
||
def self.find_or_create_from_omniauth(omniauth) | ||
user_attributes = Redmine::OmniAuthSAML.user_attributes_from_saml omniauth | ||
Rails.logger.info "bobo" + user_attributes.inspect | ||
user = self.find_by_login(user_attributes[:login]) | ||
unless user | ||
user = EmailAddress.find_by(address: user_attributes[:mail]).try(:user) | ||
if user.nil? && Redmine::OmniAuthSAML.onthefly_creation? | ||
user = new user_attributes | ||
user = User.new(:status => 1, :language => Setting.default_language) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the code can be changed to: new user_attributes.merge(:status => 1, :language => Setting.default_language) |
||
# user = new user_attributes | ||
user.mail = user_attributes[:mail] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this code is useless because of previous suggested (or original) initialization |
||
user.firstname = user_attributes[:firstname] | ||
user.lastname = user_attributes[:lastname] | ||
user.created_by_omniauth_saml = true | ||
user.login = user_attributes[:login] | ||
user.language = Setting.default_language | ||
user.login = omniauth.uid #this is onelogin specific probably | ||
user.activate | ||
user.save! | ||
user.reload | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
Redmine::OmniAuthSAML::Base.configure do |config| | ||
config.saml = { | ||
# :assertion_consumer_service_url => "http://yourcompany.redminegit.com/auth/saml/callback", # OmniAuth callback URL | ||
:assertion_consumer_service_url => "http://yourcompany.redminegit.com/auth/saml/consume", # OmniAuth callback URL | ||
:issuer => "https://app.onelogin.com/saml/metadata/123456", # The issuer name / entity ID. Must be an URI as per SAML 2.0 s$ | ||
:idp_sso_target_url => "https://acosonic.onelogin.com/trust/saml2/http-post/sso/123456", # SSO login endpoint | ||
:idp_cert_fingerprint => "AA:AA:AA:AA:AA:E0:FB:E6:E0:38:BA:6A:6A:FA:DA:2D:03:05:2B:94", # SSO ssl certificate fingerprint | ||
# Alternatively, specify the full certifiate: | ||
#:idp_cert => "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----", | ||
:name_identifier_format => "urn:oasis:names:tc:SAML:2.0:nameid-format:persistent", | ||
:signout_url => "https://yourcomp.onelogin.com/trust/saml2/http-redirect/slo/123456", # Optional signout URL, not supported by all identity provide$ | ||
:idp_slo_target_url => "https://yourcomp.onelogin.com/trust/saml2/http-redirect/slo/123456", | ||
:name_identifier_value => "mail", # Which redmine field is used as name_identifier_value for SAML logout | ||
:attribute_mapping => { | ||
# How will we map attributes from SSO to redmine attributes | ||
:login => 'extra.raw_info.username', | ||
:mail => 'extra.raw_info.email', | ||
:firstname => 'extra.raw_info.firstname', | ||
:lastname => 'extra.raw_info.lastname' | ||
} | ||
} | ||
|
||
config.on_login do |omniauth_hash, user| | ||
# Implement any hook you want here | ||
end | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment shall be removed