sp-rails-saml 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +32 -2
- data/app/controllers/saml/ssos_base_controller.rb +3 -3
- data/app/controllers/saml/ssos_controller.rb +2 -2
- data/lib/sp-rails-saml/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a4c254224e4b68b35d60bca7c7e374889e4aa7f3bc30fb109f04a63560603d5
|
4
|
+
data.tar.gz: 658376899e39c2057a1bc3b3f01302f21f43af21e40c4cc797c962382d27655a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d614e499f13a0027e94272bf0f73f4cb6ca68af5b8fa3fd362b1be85db8bfc6e507adeff371dfe2fd54a34548909fc969f04576b320340d07c8f2853f0065e64
|
7
|
+
data.tar.gz: 0d8ea7ce7eba68f54f5f3a84791dcdc1dc7e92875fd48023a0b96ed1b76d57239348fc9e054a5b3b3d94e50eb43731e7c2da8fb3f376b3aab78a075fef6c0ed6
|
data/README.md
CHANGED
@@ -50,6 +50,13 @@ $ rails g sp_rails_saml:install {reference_table_name}
|
|
50
50
|
At this point, you need to write your account table name in `reference_table_name`.
|
51
51
|
This will generate the saml templates for controller, view, model, initializer, etc.
|
52
52
|
|
53
|
+
|
54
|
+
If you need only saml sp initiated and idp initiated template
|
55
|
+
|
56
|
+
```
|
57
|
+
$ rails g sp_rails_saml:install {reference_table_name} --settings false
|
58
|
+
```
|
59
|
+
|
53
60
|
**Controller**
|
54
61
|
- [app/controllers/saml/sessions_controller.rb](https://github.com/metaps/sp-rails-saml/blob/develop/lib/generators/sp-rails-saml/templates/controllers/sessions_controller.rb)
|
55
62
|
- [app/controllers/saml/ssos_controller.rb](https://github.com/metaps/sp-rails-saml/blob/develop/lib/generators/sp-rails-saml/templates/controllers/sessions_controller.rb)
|
@@ -72,15 +79,24 @@ To configure routings for above templates, just add the following line to your
|
|
72
79
|
|
73
80
|
```ruby
|
74
81
|
sp_rails_saml_routes
|
82
|
+
|
83
|
+
# if you need only saml sp initiated and idp initiated routing
|
84
|
+
sp_rails_saml_routes(sso_only: true)
|
75
85
|
```
|
76
86
|
|
77
87
|
This routing method encompasses the following endpoints:
|
78
88
|
|
79
89
|
```
|
80
|
-
|
81
|
-
|
90
|
+
# metadata url
|
91
|
+
GET /saml/sp/metadata/:id
|
82
92
|
|
93
|
+
# acs url
|
94
|
+
POST /saml/sp/consume/:id
|
95
|
+
|
96
|
+
# saml login page
|
83
97
|
GET /saml/sign_in
|
98
|
+
|
99
|
+
# start saml sp initiated
|
84
100
|
POST /saml/sign_in
|
85
101
|
|
86
102
|
GET /saml/saml_settings
|
@@ -116,6 +132,11 @@ skip_before_action :authenticate_user!
|
|
116
132
|
You need to add the follwing line to your `ApplicationController`:
|
117
133
|
|
118
134
|
```ruby
|
135
|
+
def sign_in_with_saml(user)
|
136
|
+
# add create session logic
|
137
|
+
end
|
138
|
+
|
139
|
+
# using devise example
|
119
140
|
def sign_in_with_saml(user)
|
120
141
|
sign_in(:user, user)
|
121
142
|
redirect_to root_path
|
@@ -126,6 +147,15 @@ end
|
|
126
147
|
|
127
148
|
Once the above process is complete, you can edit your saml credentials in `/saml/saml_settings/edit`.
|
128
149
|
|
150
|
+
|
151
|
+
## Check Saml Value
|
152
|
+
|
153
|
+
sp-rails-saml only validate below list value
|
154
|
+
|
155
|
+
- SAML Response AudienceRestriction
|
156
|
+
- SAML Response Signature
|
157
|
+
- SAML Response Destination
|
158
|
+
|
129
159
|
## :page_facing_up: License
|
130
160
|
|
131
161
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
@@ -4,7 +4,7 @@ module Saml
|
|
4
4
|
class SsosBaseController < SamlBaseController
|
5
5
|
skip_forgery_protection only: %w[consume]
|
6
6
|
|
7
|
-
# POST /saml/
|
7
|
+
# POST /saml/sp/consume/:id
|
8
8
|
def consume
|
9
9
|
setting = SpRailsSaml::Settings.instance
|
10
10
|
account = setting.account_class.find_by!(setting.account_find_key => params[setting.account_find_key])
|
@@ -16,14 +16,14 @@ module Saml
|
|
16
16
|
|
17
17
|
raise SpRailsSaml::SamlResponseInvalid, saml_response.errors unless saml_response.valid?
|
18
18
|
|
19
|
-
user = setting.user_class.find_by(setting.saml_response_user_find_key => saml_response.name_id)
|
19
|
+
user = setting.user_class.find_by(setting.saml_response_user_find_key => saml_response.name_id, setting.account_class.to_s.downcase => account)
|
20
20
|
|
21
21
|
raise SpRailsSaml::LoginUserNotFound if user.blank?
|
22
22
|
|
23
23
|
sign_in_with_saml(user)
|
24
24
|
end
|
25
25
|
|
26
|
-
# GET /saml/metadata/:id
|
26
|
+
# GET /saml/sp/metadata/:id
|
27
27
|
def metadata
|
28
28
|
setting = SpRailsSaml::Settings.instance
|
29
29
|
account = setting.account_class.find_by!(setting.account_find_key => params[setting.account_find_key])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sp-rails-saml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- psyashes
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-10-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ruby-saml
|
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '0'
|
85
85
|
requirements: []
|
86
|
-
rubygems_version: 3.
|
86
|
+
rubygems_version: 3.0.3
|
87
87
|
signing_key:
|
88
88
|
specification_version: 4
|
89
89
|
summary: Simple sp saml for rails.
|