omniauth-proconnect 0.3.0 → 0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/.rubocop_todo.yml +20 -0
- data/README.md +58 -1
- data/lib/omniauth/proconnect/version.rb +1 -1
- data/lib/omniauth/proconnect.rb +18 -7
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7f69d22759a84bda39c5b20a6d631c116ddecf85ad9e0f64039a11f3e4fbf98
|
4
|
+
data.tar.gz: 625c7d42937c3cdb64c1dd1b85b61f72ddf606ee1ebedea30253b3979b5cf2e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7730f981481a35c7987dc1f1756715ddf773182fc3f7f0ee502237899e46aa9c05d3219a8bb63ef951728711cd9f334e5a79ba0ec603d1f891e1c93ef7ec3f19
|
7
|
+
data.tar.gz: ffeab52d87c2ec7043de16c4dadcf66c4bbb534b4b02b79818772345b96807a7da1d2f703d50c98ff98d64535f73d9696067d834550a404092afdac395705654
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2025-05-23 15:10:03 UTC using RuboCop version 1.75.4.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
# Configuration parameters: CountComments, CountAsOne.
|
11
|
+
Metrics/ClassLength:
|
12
|
+
Max: 123
|
13
|
+
|
14
|
+
# Offense count: 1
|
15
|
+
# Configuration parameters: AllowedConstants.
|
16
|
+
Style/Documentation:
|
17
|
+
Exclude:
|
18
|
+
- 'spec/**/*'
|
19
|
+
- 'test/**/*'
|
20
|
+
- 'lib/omniauth/proconnect.rb'
|
data/README.md
CHANGED
@@ -21,7 +21,7 @@ Une fois que vous avez créé votre application sur [l'espace
|
|
21
21
|
partenaires de
|
22
22
|
ProConnect](https://partenaires.proconnect.gouv.fr/apps) et identifié
|
23
23
|
vos endpoints grâce à leur [documentation
|
24
|
-
technique](https://partenaires.proconnect.gouv.fr/docs/fournisseur-service/implementation_technique)
|
24
|
+
technique](https://partenaires.proconnect.gouv.fr/docs/fournisseur-service/implementation_technique)
|
25
25
|
:
|
26
26
|
|
27
27
|
1. installer la gem `bundle add omniauth-proconnect` ;
|
@@ -59,6 +59,63 @@ end
|
|
59
59
|
redirect_to "/auth/proconnect/logout"
|
60
60
|
```
|
61
61
|
|
62
|
+
## Informations retournées
|
63
|
+
|
64
|
+
Les [informations retournées par
|
65
|
+
ProConnect](https://partenaires.proconnect.gouv.fr/docs/fournisseur-service/scope-claims)
|
66
|
+
sont mises à diposition dans le hash OmniAuth
|
67
|
+
(`request.env["omniauth.auth"]`) :
|
68
|
+
|
69
|
+
* la partie `info` contient tout ce qui peut être standardisé [selon
|
70
|
+
le Auth Hash Schema d'Omniauth](https://github.com/omniauth/omniauth/wiki/Auth-Hash-Schema)
|
71
|
+
* le reste/l'intégralité est disponible dans `extra`.
|
72
|
+
|
73
|
+
Exemple :
|
74
|
+
|
75
|
+
```json
|
76
|
+
{
|
77
|
+
"provider": "proconnect",
|
78
|
+
"uid": "e7a41249-123d-46b7-b362-5f00d3166ea1",
|
79
|
+
"info": {
|
80
|
+
"email": "test@gouv.fr",
|
81
|
+
"first_name": null,
|
82
|
+
"last_name": null,
|
83
|
+
"name": "",
|
84
|
+
"phone": null,
|
85
|
+
"provider": "proconnect",
|
86
|
+
"uid": "e7a41249-123d-46b7-b362-5f00d3166ea1"
|
87
|
+
},
|
88
|
+
"credentials": {},
|
89
|
+
"extra": {
|
90
|
+
"raw_info": {
|
91
|
+
"sub": "e7a41249-123d-46b7-b362-5f00d3166ea1",
|
92
|
+
"email": "test@gouv.fr",
|
93
|
+
"siret": "13002526500013",
|
94
|
+
"aud": "f90c1231117ec6f731af9f93a07c54ff372130c17a3bbad43488699865d85c64",
|
95
|
+
"exp": 1748010049,
|
96
|
+
"iat": 1748009989,
|
97
|
+
"iss": "https://issuer-oidc.gouv.fr/api/v42"
|
98
|
+
}
|
99
|
+
}
|
100
|
+
}
|
101
|
+
```
|
102
|
+
|
103
|
+
```ruby
|
104
|
+
class SessionsController < ApplicationController
|
105
|
+
def create
|
106
|
+
data = request.env["omniauth.auth"]
|
107
|
+
|
108
|
+
email = data.info.email
|
109
|
+
siret = data.extra.raw_info.siret
|
110
|
+
|
111
|
+
# or, if you're feeling fancy
|
112
|
+
data => { info: { email: }, extra: { raw_info: { siret: } } }
|
113
|
+
|
114
|
+
# [...]
|
115
|
+
end
|
116
|
+
end
|
117
|
+
```
|
118
|
+
|
62
119
|
## Contribution
|
63
120
|
|
64
121
|
La stratégie est loin d'être complète ; n'hésitez pas à contribuer des
|
data/lib/omniauth/proconnect.rb
CHANGED
@@ -47,16 +47,27 @@ module OmniAuth
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
-
|
51
|
-
|
50
|
+
# userinfo-operating DSL from OmniAuth
|
51
|
+
uid do
|
52
|
+
@userinfo["sub"]
|
52
53
|
end
|
53
54
|
|
54
|
-
|
55
|
+
info do
|
55
56
|
{
|
56
|
-
email: @userinfo["email"]
|
57
|
+
email: @userinfo["email"],
|
58
|
+
first_name: @userinfo["given_name"],
|
59
|
+
last_name: @userinfo["usual_name"],
|
60
|
+
name: [@userinfo["given_name"], @userinfo["usual_name"]].compact.join(" "),
|
61
|
+
phone: @userinfo["phone_number"],
|
62
|
+
provider: "proconnect",
|
63
|
+
uid: @userinfo["sub"]
|
57
64
|
}
|
58
65
|
end
|
59
66
|
|
67
|
+
extra do
|
68
|
+
{ raw_info: @userinfo }
|
69
|
+
end
|
70
|
+
|
60
71
|
private
|
61
72
|
|
62
73
|
def connection
|
@@ -71,9 +82,7 @@ module OmniAuth
|
|
71
82
|
end
|
72
83
|
|
73
84
|
def discover_endpoint!
|
74
|
-
connection
|
75
|
-
.get(".well-known/openid-configuration")
|
76
|
-
.body
|
85
|
+
connection.get(".well-known/openid-configuration").body
|
77
86
|
end
|
78
87
|
|
79
88
|
def authorization_uri
|
@@ -147,9 +156,11 @@ module OmniAuth
|
|
147
156
|
end
|
148
157
|
|
149
158
|
def verify_state!(other_state)
|
159
|
+
# rubocop:disable Style/GuardClause
|
150
160
|
if other_state != current_state
|
151
161
|
raise "a request came back with a different 'state' parameter than what we had last stored."
|
152
162
|
end
|
163
|
+
# rubocop:enable Style/GuardClause
|
153
164
|
end
|
154
165
|
end
|
155
166
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-proconnect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stéphane Maniaci
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-05-
|
10
|
+
date: 2025-05-23 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: faraday
|
@@ -51,8 +51,9 @@ dependencies:
|
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '0'
|
54
|
-
description:
|
55
|
-
|
54
|
+
description: |
|
55
|
+
An OmniAuth strategy for ProConnect, an official
|
56
|
+
OIDC solution for French professionnals to login.
|
56
57
|
email:
|
57
58
|
- stephane.maniaci@gmail.com
|
58
59
|
executables: []
|
@@ -61,6 +62,7 @@ extra_rdoc_files: []
|
|
61
62
|
files:
|
62
63
|
- ".rspec"
|
63
64
|
- ".rubocop.yml"
|
65
|
+
- ".rubocop_todo.yml"
|
64
66
|
- LICENSE.txt
|
65
67
|
- README.md
|
66
68
|
- Rakefile
|