summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2022-04-01 16:33:51 -0600
committermo khan <mo@mokhan.ca>2022-04-01 16:33:51 -0600
commit7afe256048b65d560d71c93622ff10e4ce7638a5 (patch)
tree92b4eb106cee2dd4051c557379427ec12fefaf4b
parentd2d6b3f44f62bf12e152170b59366d50e7950a52 (diff)
read attributes from config
-rw-r--r--src/saml-idp/main.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/saml-idp/main.rb b/src/saml-idp/main.rb
index 03538c5..86aa6bb 100644
--- a/src/saml-idp/main.rb
+++ b/src/saml-idp/main.rb
@@ -25,14 +25,18 @@ class Configuration
end
class User
+ def initialize(attributes)
+ @attributes = attributes
+ end
+
def name_id_for(name_id_format)
- $config[:email]
+ @attributes[:email]
end
def assertion_attributes_for(request)
{
- Username: $config[:email],
- MemberOf: $config[:member_of]
+ Username: @attributes[:email],
+ MemberOf: @attributes[:member_of]
}
end
end
@@ -108,7 +112,7 @@ class IdentityProvider
saml_request = binding_for(request).deserialize(params)
@builder = nil
url, saml_params = saml_request.response_for(
- User.new,
+ User.new($config),
binding: :http_post,
relay_state: params[:RelayState]
) do |builder|