FIX: SSO provider secrets - check wildcard domains last, toggle secrets visibility
This commit is contained in:
parent
f6eff38c0e
commit
c104256991
|
@ -7,7 +7,7 @@
|
|||
icon="times"
|
||||
class="remove-value-btn btn-small"}}
|
||||
{{input value=value.key class="value-input" focus-out=(action "changeKey" index)}}
|
||||
{{input value=value.secret class="value-input" focus-out=(action "changeSecret" index) type="password"}}
|
||||
{{input value=value.secret class="value-input" focus-out=(action "changeSecret" index) type=(if isSecret "password" "text")}}
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
{{secret-value-list setting=setting values=value}}
|
||||
{{secret-value-list setting=setting values=value isSecret=isSecret}}
|
||||
{{setting-validation-message message=validationMessage}}
|
||||
<div class='desc'>{{{unbound setting.description}}}</div>
|
||||
|
|
|
@ -345,6 +345,7 @@ login:
|
|||
default: ''
|
||||
type: list
|
||||
list_type: secret
|
||||
secret: true
|
||||
placeholder:
|
||||
key: "sso_provider.key_placeholder"
|
||||
value: "sso_provider.value_placeholder"
|
||||
|
|
|
@ -92,8 +92,10 @@ class SingleSignOn
|
|||
provider_secrets = SiteSetting.sso_provider_secrets.split(/[\|,\n]/)
|
||||
provider_secrets_hash = Hash[*provider_secrets]
|
||||
return_url_host = URI.parse(return_sso_url).host
|
||||
# moves wildcard domains to the end of hash
|
||||
sorted_secrets = provider_secrets_hash.sort_by { |k, _| k }.reverse.to_h
|
||||
|
||||
secret = provider_secrets_hash.select do |domain, _|
|
||||
secret = sorted_secrets.select do |domain, _|
|
||||
WildcardDomainChecker.check_domain(domain, return_url_host)
|
||||
end
|
||||
secret.present? ? secret.values.first : nil
|
||||
|
|
|
@ -589,7 +589,7 @@ RSpec.describe SessionController do
|
|||
SiteSetting.enable_sso_provider = true
|
||||
SiteSetting.enable_sso = false
|
||||
SiteSetting.enable_local_logins = true
|
||||
SiteSetting.sso_provider_secrets = "www.random.site|secretForRandomSite\nsomewhere.over.rainbow|secretForOverRainbow"
|
||||
SiteSetting.sso_provider_secrets = "*|secretforAll\n*.rainbow|wrongSecretForOverRainbow\nwww.random.site|secretForRandomSite\nsomewhere.over.rainbow|secretForOverRainbow"
|
||||
|
||||
@sso = SingleSignOn.new
|
||||
@sso.nonce = "mynonce"
|
||||
|
|
Loading…
Reference in New Issue