openid_config_parser 0.1.0 → 0.1.1
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/CHANGELOG.md +3 -0
- data/README.md +44 -17
- data/lib/openid_config_parser/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddd178567c09e3fbf06238765bb5b54e17f8127af335359a438ae62423f7b4c7
|
4
|
+
data.tar.gz: f569c653f34e4d11fbcfa922c861a5afa57f9eba9ee125c3a7cbf89c46497848
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78bf5c62d4a329e0682d91e6cf3cc6885ed096e44be98e5707c73edb8a0fd4a9b58c67b7db7cd1724e723cde16d9a149b66f393e0d1240da3c9bcc5a639dd939
|
7
|
+
data.tar.gz: d91c6b19898d912b2ddf3856ed70732ece864cff8e34767e69fcdcfad57cef454d5ceee3be4f40438a266eea7e68dd184793542505fb1d78b2d146b85d6ac69d
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,34 +1,61 @@
|
|
1
1
|
# OpenidConfigParser
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
`openid_config_parser` is a lightweight Rubygem containing a method that fetches and
|
4
|
+
parses OpenID Connect configuration data from a specified endpoint URL and returns a Hash
|
5
|
+
object. It includes error handling to manage various issues that might occur during the
|
6
|
+
HTTP request and JSON parsing process.
|
6
7
|
|
7
8
|
## Installation
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
Install the gem and add to the application's Gemfile by executing:
|
10
|
+
To install the gem run the following command in the terminal:
|
12
11
|
|
13
|
-
$ bundle add
|
12
|
+
$ bundle add openid_config_parser
|
14
13
|
|
15
14
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
16
15
|
|
17
|
-
$ gem install
|
16
|
+
$ gem install openid_config_parser
|
18
17
|
|
19
18
|
## Usage
|
20
19
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
20
|
+
For non-Rails application you might need to require the gem in your file like so:
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
require 'openid_config_parser'
|
24
|
+
```
|
25
|
+
|
26
|
+
You can use the `openid_config_parser` in any of your Rails controllers, models, or
|
27
|
+
other parts of your application.
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
# app/controllers/application_controller.rb
|
31
|
+
|
32
|
+
class ApplicationController < ActionController::Base
|
33
|
+
def fetch_openid_config
|
34
|
+
endpoint = "https://example.com/.well-known/openid-configuration"
|
35
|
+
config = OpenidConfigParser.fetch_openid_configuration(endpoint)
|
36
|
+
|
37
|
+
if config
|
38
|
+
issuer = config[:issuer]
|
39
|
+
auth_endpoint = config[:authorization_endpoint]
|
40
|
+
token_endpoint = config[:token_endpoint]
|
41
|
+
jwks_uri = config[:]
|
42
|
+
userinfo_endpoint = config[:userinfo_endpoint]
|
43
|
+
# and so on
|
44
|
+
else
|
45
|
+
Rails.logger.error "Failed to fetch OpenID configuration"
|
46
|
+
end
|
47
|
+
rescue OpenidConfigParser::Error => e
|
48
|
+
Rails.logger.error "Error fetching OpenID configuration: #{e.message}"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
```
|
52
|
+
|
53
|
+
Considering that HTTP request is made to fetch the endpoint configuration, you can call
|
54
|
+
this method in a background job for optimized performance.
|
28
55
|
|
29
56
|
## Contributing
|
30
57
|
|
31
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
58
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/msuliq/openid_config_parser. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/msuliq/openid_config_parser/blob/main/CODE_OF_CONDUCT.md).
|
32
59
|
|
33
60
|
## License
|
34
61
|
|
@@ -36,4 +63,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
36
63
|
|
37
64
|
## Code of Conduct
|
38
65
|
|
39
|
-
Everyone interacting in the OpenidConfigParser project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
66
|
+
Everyone interacting in the OpenidConfigParser project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/msuliq/openid_config_parser/blob/main/CODE_OF_CONDUCT.md).
|