Skip to content

Commit 8135ec8

Browse files
committed
fix some rubocop issues
1 parent 74f0db1 commit 8135ec8

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

code0-identities.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ Gem::Specification.new do |spec|
3131
spec.require_paths = ["lib"]
3232

3333
spec.add_dependency "httparty", "~> 0.22"
34-
spec.add_dependency "ruby-saml", '~> 1.17.0'
34+
spec.add_dependency "ruby-saml", "~> 1.17.0"
3535

36-
spec.add_development_dependency "webmock", "~> 3.23.1"
3736
spec.add_development_dependency "rake", "~> 13.0"
3837
spec.add_development_dependency "rspec", "~> 3.0"
3938
spec.add_development_dependency "rubocop", "~> 1.21"
4039
spec.add_development_dependency "rubocop-rake", "~> 0.6"
4140
spec.add_development_dependency "rubocop-rspec", "~> 2.29" # Uncomment to register a new dependency of your gem
41+
spec.add_development_dependency "webmock", "~> 3.23.1"
4242
spec.metadata["rubygems_mfa_required"] = "true"
4343
end

lib/code0/identities.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
require "httparty"
4-
require 'onelogin/ruby-saml'
4+
require "onelogin/ruby-saml"
55

66
require_relative "identities/version"
77
require_relative "identities/identity_provider"

lib/code0/identities/provider/saml.rb

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,23 @@ def authorization_url
1818
end
1919

2020
def load_identity(**params)
21-
response = OneLogin::RubySaml::Response.new(params[:SAMLResponse], { **config[:response_settings], settings: create_settings })
21+
response = OneLogin::RubySaml::Response.new(params[:SAMLResponse],
22+
{ **config[:response_settings], settings: create_settings })
2223
attributes = response.attributes
2324

2425
Identity.new(config[:provider_name],
2526
response.name_id,
2627
find_attribute(attributes, config[:attribute_statements][:username]),
2728
find_attribute(attributes, config[:attribute_statements][:email]),
2829
find_attribute(attributes, config[:attribute_statements][:firstname]),
29-
find_attribute(attributes, config[:attribute_statements][:lastname])
30-
)
30+
find_attribute(attributes, config[:attribute_statements][:lastname]))
3131
end
3232

3333
private
3434

3535
def find_attribute(attributes, attribute_statements)
3636
attribute_statements.each do |statement|
37-
unless attributes[statement].nil?
38-
return attributes[statement]
39-
end
37+
return attributes[statement] unless attributes[statement].nil?
4038
end
4139
nil
4240
end
@@ -59,10 +57,9 @@ def create_settings
5957

6058
def config
6159
config = config_loader
62-
if config_loader.is_a?(Proc)
63-
config = config_loader.call
64-
end
60+
config = config_loader.call if config_loader.is_a?(Proc)
6561

62+
# rubocop:disable Layout/LineLength
6663
config[:provider_name] ||= :saml
6764
config[:response_settings] ||= {}
6865
config[:settings] ||= {}
@@ -71,10 +68,11 @@ def config
7168
config[:attribute_statements][:email] ||= %w[email mail http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress http://schemas.microsoft.com/ws/2008/06/identity/claims/emailaddress]
7269
config[:attribute_statements][:firstname] ||= %w[first_name firstname firstName http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname http://schemas.microsoft.com/ws/2008/06/identity/claims/givenname]
7370
config[:attribute_statements][:lastname] ||= %w[last_name lastname lastName http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname http://schemas.microsoft.com/ws/2008/06/identity/claims/surname]
71+
# rubocop:enable Layout/LineLength
7472

7573
config
7674
end
7775
end
7876
end
7977
end
80-
end
78+
end

0 commit comments

Comments
 (0)