omniauth_openid_connect_test 0.3.6

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: dcd092ea9e3c05fe783cde0bb2a51184a9795ab0edacd32d699e7592621e73cd
4
+ data.tar.gz: 8d9d25e0eb4fc34f6dcc534966d2c3afb5051721aa2ac09a2d01fc0fe863c3ff
5
+ SHA512:
6
+ metadata.gz: 5784be4f854682e9d568aa897c0b0d4133460cffcd374893688bfd857faa62d2af97e447560be0a25eb9656eb0608871dc7ff0dbc65a74198a54a9958a0d0c4c
7
+ data.tar.gz: 844f92a5f75bc5315fab64461dfd51ddf3b04ff905a47e7e19d03b7462ed7209e8c79849ed07738d644a8ee4644b2d3b2e010242024b41b66203ba73ee14c1f9
@@ -0,0 +1,59 @@
1
+ # Description: The name of the check that will be created.
2
+ # Valid Options: A reasonably sized string.
3
+ # Default: 'Rubocop Action'
4
+ check_name: 'Rubocop Results'
5
+
6
+ # Description: Versions required to run your RuboCop checks.
7
+ # Valid options: RuboCop and any RuboCop extension, by default the latest gem version will be used. You can explicitly state that
8
+ # (not required) or use a version number, like '1.5.1'.
9
+ # Default:
10
+ # versions:
11
+ # - rubocop: 'latest'
12
+ versions:
13
+ - rubocop
14
+ - rubocop-minitest
15
+ - rubocop-performance: '1.5.1'
16
+
17
+ # Description: Rubocop configuration file path relative to the workspace.
18
+ # Valid options: A valid file path inside of the workspace.
19
+ # Default: nil
20
+ # Note: This does not need to be filled out for Rubocop to still find your config.
21
+ # Resource: https://rubocop.readthedocs.io/en/stable/configuration/
22
+ rubocop_config_path: '.rubocop.yml'
23
+
24
+ # Run all cops enabled by configuration except this list.
25
+ # Valid options: list of valid cop(s) and/or departments.
26
+ # Default: nil
27
+ # Resource: https://rubocop.readthedocs.io/en/stable/cops/
28
+ # rubocop_excluded_cops:
29
+ # - 'Style/FrozenStringLiteralComment'
30
+
31
+ # Minimum severity for exit with error code
32
+ # Valid options: 'refactor', 'convention', 'warning', 'error', or 'fatal'.
33
+ # Default: 'warning'
34
+ # Resource: https://rubocop.readthedocs.io/en/stable/configuration/#severity
35
+ # rubocop_fail_level: 'warning'
36
+
37
+ # Whether or not to use --force-exclusion when building the rubocop command. Use this if you are only linting modified
38
+ # files and typically excluded files have been changed. For example, if you exclude db/schema.rb in your rubocop.yml
39
+ # but a change gets made, then with the check_scope config set to 'modified' rubocop will lint db/schema.rb. If you set
40
+ # this to true, rubocop will ignore it.
41
+ # Valid options: true || false
42
+ # Default: false
43
+
44
+ # Instead of installing gems from rubygems, we can run `bundle install` on your project,
45
+ # you would need to do this if you are using something like 'rubocop-github' or if you don't
46
+ # want to list out dependencies with the `versions` key.
47
+ # Valid options: true || false
48
+ # Default: false
49
+ # bundle: false
50
+
51
+ # The scope of code that Rubocop should lint. Use this if you only want to lint changed files. If this is not set
52
+ # or not equal to 'modified', Rubocop is run against the entire codebase. Note that this will not work on the master branch.
53
+ # Valid options: 'modified'
54
+ # Default: nil
55
+
56
+ # The base branch against which changes will be compared, if check_scope config is set to 'modified'.
57
+ # This setting is not used if check_scope != 'modified'.
58
+ # Valid options: 'origin/another_branch'
59
+ # Default: 'origin/master'
data/.github/stale.yml ADDED
@@ -0,0 +1,17 @@
1
+ # Number of days of inactivity before an issue becomes stale
2
+ daysUntilStale: 60
3
+ # Number of days of inactivity before a stale issue is closed
4
+ daysUntilClose: 7
5
+ # Issues with these labels will never be considered stale
6
+ exemptLabels:
7
+ - pinned
8
+ - security
9
+ # Label to use when marking an issue as stale
10
+ staleLabel: wontfix
11
+ # Comment to post when marking an issue as stale. Set to `false` to disable
12
+ markComment: >
13
+ This issue has been automatically marked as stale because it has not had
14
+ recent activity. It will be closed if no further activity occurs. Thank you
15
+ for your contributions.
16
+ # Comment to post when closing a stale issue. Set to `false` to disable
17
+ closeComment: false
@@ -0,0 +1,22 @@
1
+ name: Rubocop check
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - "*"
7
+ push:
8
+ branches:
9
+ - master
10
+ jobs:
11
+ build:
12
+ name: RuboCop Action
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - name: Checkout Action
16
+ uses: actions/checkout@v1
17
+ - name: Rubocop Linter Action
18
+ uses: andrewmcodes/rubocop-linter-action@v3.2.0
19
+ with:
20
+ action_config_path: '.github/config/rubocop_linter_action.yml'
21
+ env:
22
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
data/.gitignore ADDED
@@ -0,0 +1,20 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .idea
6
+ .yardoc
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .ruby-version
19
+ .ruby-gemset
20
+ Gemfile.lock
data/.rubocop.yml ADDED
@@ -0,0 +1,58 @@
1
+ LineLength:
2
+ Description: 'Limit lines to 130 characters.'
3
+ Max: 130
4
+
5
+ Layout/SpaceInsideStringInterpolation:
6
+ Enabled: false
7
+
8
+ Layout/MultilineOperationIndentation:
9
+ EnforcedStyle: indented
10
+
11
+ StringLiterals:
12
+ EnforcedStyle: single_quotes
13
+
14
+ Style/TrailingCommaInArrayLiteral:
15
+ EnforcedStyleForMultiline: comma
16
+ Style/TrailingCommaInHashLiteral:
17
+ EnforcedStyleForMultiline: comma
18
+
19
+ Style/SafeNavigation:
20
+ Enabled: false
21
+
22
+ Style/EmptyMethod:
23
+ Description: 'Checks the formatting of empty method definitions.'
24
+ StyleGuide: '#no-single-line-methods'
25
+ Enabled: false
26
+
27
+ HashSyntax:
28
+ Description: "Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax\n{ :a => 1, :b => 2 }"
29
+ EnforcedStyle: ruby19
30
+ Enabled: true
31
+
32
+ RedundantBegin:
33
+ Enabled: true
34
+
35
+ Documentation:
36
+ Enabled: false
37
+
38
+ Metrics/AbcSize:
39
+ Max: 50
40
+
41
+ Metrics/CyclomaticComplexity:
42
+ Max: 50
43
+
44
+ Metrics/PerceivedComplexity:
45
+ Max: 15
46
+
47
+ Metrics/BlockLength:
48
+ Max: 40
49
+
50
+ Metrics/MethodLength:
51
+ Max: 45
52
+
53
+ AllCops:
54
+ Exclude:
55
+ - bin/**/*
56
+ - Rakefile
57
+ - config/**/*
58
+ - test/**/*
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.4
4
+ - 2.5
5
+ - 2.6
6
+ - 2.7
7
+ - jruby-head
8
+ - ruby-head
data/CHANGELOG.md ADDED
@@ -0,0 +1,47 @@
1
+ # v0.3.5 (07.06.2020)
2
+
3
+ - bugfix: Info from decoded id_token is not exposed into `request.env['omniauth.auth']` [#61](https://github.com/m0n9oose/omniauth_openid_connect/pull/61)
4
+ - bugfix: NoMethodError (`undefined method 'count' for #<OpenIDConnect::ResponseObject::IdToken>`) [#60](https://github.com/m0n9oose/omniauth_openid_connect/pull/60)
5
+
6
+ # v0.3.4 (21.05.2020)
7
+
8
+ - Try to verify id_token when response_type is code [#44](https://github.com/m0n9oose/omniauth_openid_connect/pull/44)
9
+ - Provide more information on error [#49](https://github.com/m0n9oose/omniauth_openid_connect/pull/49)
10
+ - Update configuration documentation [#53](https://github.com/m0n9oose/omniauth_openid_connect/pull/53)
11
+ - Add documentation about the send_scope_to_token_endpoint config property [#52](https://github.com/m0n9oose/omniauth_openid_connect/pull/52)
12
+ - refactor: take uid_field from raw_attributes [#54](https://github.com/m0n9oose/omniauth_openid_connect/pull/54)
13
+ - chore(ci): add 2.7, ruby-head and jruby-head [#55](https://github.com/m0n9oose/omniauth_openid_connect/pull/55)
14
+
15
+ # v0.3.3 (09.11.2019)
16
+
17
+ - Pass `acr_values` to authorize url [#43](https://github.com/m0n9oose/omniauth_openid_connect/pull/43)
18
+ - Add raw info for id token [#42](https://github.com/m0n9oose/omniauth_openid_connect/pull/42)
19
+ - Fixed `id_token` verification when `id_token` is not used [#41](https://github.com/m0n9oose/omniauth_openid_connect/pull/41)
20
+ - Cast `response_type` to string when checking if it is set in params [#36](https://github.com/m0n9oose/omniauth_openid_connect/pull/36)
21
+ - Support both symbol and string version of `response_type` option [#35](https://github.com/m0n9oose/omniauth_openid_connect/pull/35)
22
+ - Fix gemspec homepage [#33](https://github.com/m0n9oose/omniauth_openid_connect/pull/33)
23
+ - Add support for `response_type` `id_token` [#32](https://github.com/m0n9oose/omniauth_openid_connect/pull/32)
24
+
25
+ # v0.3.2 (03.08.2019)
26
+
27
+ - Use response_mode in `authorize_uri` if the option is defined [#30](https://github.com/m0n9oose/omniauth_openid_connect/pull/30)
28
+ - Move verification of `id_token` to before accessing tokens [#28](https://github.com/m0n9oose/omniauth_openid_connect/pull/28)
29
+ - Update omniauth dependency [#26](https://github.com/m0n9oose/omniauth_openid_connect/pull/26)
30
+
31
+ # v0.3.1 (08.06.2019)
32
+
33
+ - Set default OmniAuth name to openid_connect [#23](https://github.com/m0n9oose/omniauth_openid_connect/pull/23)
34
+
35
+ # v0.3.0 (27.04.2019)
36
+
37
+ - RP-Initiated Logout phase [#5](https://github.com/m0n9oose/omniauth_openid_connect/pull/5)
38
+ - Allows `ui_locales`, `claims_locales` and `login_hint` as request params [#6](https://github.com/m0n9oose/omniauth_openid_connect/pull/6)
39
+ - Make uid label configurable [#11](https://github.com/m0n9oose/omniauth_openid_connect/pull/11)
40
+ - Allow rails applications to handle state mismatch [#14](https://github.com/m0n9oose/omniauth_openid_connect/pull/14)
41
+ - Handle errors when fetching access_token at callback_phase [#17](https://github.com/m0n9oose/omniauth_openid_connect/pull/17)
42
+ - Allow state method to receive env [#19](https://github.com/m0n9oose/omniauth_openid_connect/pull/19)
43
+
44
+ # v0.2.4 (06.01.2019)
45
+
46
+ - Prompt and login hint [#4](https://github.com/m0n9oose/omniauth_openid_connect/pull/4)
47
+ - Bump openid_connect dependency [#9](https://github.com/m0n9oose/omniauth_openid_connect/pull/9)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ # A sample Guardfile
4
+ # More info at https://github.com/guard/guard#readme
5
+
6
+ guard 'minitest' do
7
+ # with Minitest::Unit
8
+ watch(%r{^test/(.*)\/(.*)_test\.rb})
9
+ watch(%r{^lib/(.*)\.rb}) { |m| "test/lib/#{m[1]}_test.rb" }
10
+ watch(%r{^test/test_helper\.rb}) { 'test' }
11
+ end
12
+
13
+ guard :bundler do
14
+ watch('Gemfile')
15
+ watch(/^.+\.gemspec/)
16
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 John Bohn
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,126 @@
1
+ # OmniAuth::OpenIDConnect
2
+
3
+ Originally was [omniauth-openid-connect](https://github.com/jjbohn/omniauth-openid-connect)
4
+
5
+ I've forked this repository and launch as separate gem because maintaining of original was dropped.
6
+
7
+ [![Build Status](https://travis-ci.org/m0n9oose/omniauth_openid_connect.png?branch=master)](https://travis-ci.org/m0n9oose/omniauth_openid_connect)
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ gem 'omniauth_openid_connect'
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install omniauth_openid_connect
22
+
23
+ ## Supported Ruby Versions
24
+
25
+ OmniAuth::OpenIDConnect is tested under 2.4, 2.5, 2.6, 2.7
26
+
27
+ ## Usage
28
+
29
+ Example configuration
30
+ ```ruby
31
+ config.omniauth :openid_connect, {
32
+ name: :my_provider,
33
+ scope: [:openid, :email, :profile, :address],
34
+ response_type: :code,
35
+ uid_field: "preferred_username",
36
+ client_options: {
37
+ port: 443,
38
+ scheme: "https",
39
+ host: "myprovider.com",
40
+ identifier: ENV["OP_CLIENT_ID"],
41
+ secret: ENV["OP_SECRET_KEY"],
42
+ redirect_uri: "http://myapp.com/users/auth/openid_connect/callback",
43
+ },
44
+ }
45
+ ```
46
+
47
+ ### Options Overview
48
+
49
+ | Field | Description | Required | Default | Example/Options |
50
+ |------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|----------------------------|-----------------------------------------------------|
51
+ | name | Arbitrary string to identify connection and identify it from other openid_connect providers | no | String: openid_connect | :my_idp |
52
+ | issuer | Root url for the authorization server | yes | | https://myprovider.com |
53
+ | discovery | Should OpenID discovery be used. This is recommended if the IDP provides a discovery endpoint. See client config for how to manually enter discovered values. | no | false | one of: true, false |
54
+ | client_auth_method | Which authentication method to use to authenticate your app with the authorization server | no | Sym: basic | "basic", "jwks" |
55
+ | scope | Which OpenID scopes to include (:openid is always required) | no | Array<sym> [:openid] | [:openid, :profile, :email] |
56
+ | response_type | Which OAuth2 response type to use with the authorization request | no | String: code | one of: 'code', 'id_token' |
57
+ | state | A value to be used for the OAuth2 state parameter on the authorization request. Can be a proc that generates a string. | no | Random 16 character string | Proc.new { SecureRandom.hex(32) } |
58
+ | response_mode | The response mode per [spec](https://openid.net/specs/oauth-v2-form-post-response-mode-1_0.html) | no | nil | one of: :query, :fragment, :form_post, :web_message |
59
+ | display | An optional parameter to the authorization request to determine how the authorization and consent page | no | nil | one of: :page, :popup, :touch, :wap |
60
+ | prompt | An optional parameter to the authrization request to determine what pages the user will be shown | no | nil | one of: :none, :login, :consent, :select_account |
61
+ | send_scope_to_token_endpoint | Should the scope parameter be sent to the authorization token endpoint? | no | true | one of: true, false |
62
+ | post_logout_redirect_uri | The logout redirect uri to use per the [session management draft](https://openid.net/specs/openid-connect-session-1_0.html) | no | empty | https://myapp.com/logout/callback |
63
+ | uid_field | The field of the user info response to be used as a unique id | no | 'sub' | "sub", "preferred_username" |
64
+ | client_options | A hash of client options detailed in its own section | yes | | |
65
+
66
+ ### Client Config Options
67
+
68
+ These are the configuration options for the client_options hash of the configuration.
69
+
70
+ | Field | Description | Default | Replaced by discovery? |
71
+ |------------------------|-----------------------------------------------------------------|------------|------------------------|
72
+ | identifier | The OAuth2 client_id | | |
73
+ | secret | The OAuth2 client secret | | |
74
+ | redirect_uri | The OAuth2 authorization callback url in your app | | |
75
+ | scheme | The http scheme to use | https | |
76
+ | host | The host of the authorization server | nil | |
77
+ | port | The port for the authorization server | 443 | |
78
+ | authorization_endpoint | The authorize endpoint on the authorization server | /authorize | yes |
79
+ | token_endpoint | The token endpoint on the authorization server | /token | yes |
80
+ | userinfo_endpoint | The user info endpoint on the authorization server | /userinfo | yes |
81
+ | jwks_uri | The jwks_uri on the authorization server | /jwk | yes |
82
+ | end_session_endpoint | The url to call to log the user out at the authorization server | nil | yes |
83
+
84
+ ### Additional Configuration Notes
85
+ * `name` is arbitrary, I recommend using the name of your provider. The name
86
+ configuration exists because you could be using multiple OpenID Connect
87
+ providers in a single app.
88
+
89
+ **NOTE**: if you use this gem with Devise you should use `:openid_connect` name,
90
+ or Devise would route to 'users/auth/:provider' rather than 'users/auth/openid_connect'
91
+
92
+ * `response_type` tells the authorization server which grant type the application wants to use,
93
+ currently, only `:code` (Authorization Code grant) and `:id_token` (Implicit grant) are valid.
94
+ * If you want to pass `state` paramete by yourself. You can set Proc Object.
95
+ e.g. `state: Proc.new { SecureRandom.hex(32) }`
96
+ * `nonce` is optional. If don't want to pass "nonce" parameter to provider, You should specify
97
+ `false` to `send_nonce` option. (default true)
98
+ * Support for other client authentication methods. If don't specified
99
+ `:client_auth_method` option, automatically set `:basic`.
100
+ * Use "OpenID Connect Discovery", You should specify `true` to `discovery` option. (default false)
101
+ * In "OpenID Connect Discovery", generally provider should have Webfinger endpoint.
102
+ If provider does not have Webfinger endpoint, You can specify "Issuer" to option.
103
+ e.g. `issuer: "https://myprovider.com"`
104
+ It means to get configuration from "https://myprovider.com/.well-known/openid-configuration".
105
+ * The uid is by default using the `sub` value from the `user_info` response,
106
+ which in some applications is not the expected value. To avoid such limitations, the uid label can be
107
+ configured by providing the omniauth `uid_field` option to a different label (i.e. `preferred_username`)
108
+ that appears in the `user_info` details.
109
+ * The `issuer` property should exactly match the provider's issuer link.
110
+ * The `response_mode` option is optional and specifies how the result of the authorization request is formatted.
111
+ * Some OpenID Connect providers require the `scope` attribute in requests to the token endpoint, even if
112
+ this is not in the protocol specifications. In those cases, the `send_scope_to_token_endpoint`
113
+ property can be used to add the attribute to the token request. Initial value is `true`, which means that the
114
+ scope attribute is included by default.
115
+
116
+ For the full low down on OpenID Connect, please check out
117
+ [the spec](http://openid.net/specs/openid-connect-core-1_0.html).
118
+
119
+ ## Contributing
120
+
121
+ 1. Fork it ( http://github.com/m0n9oose/omniauth-openid-connect/fork )
122
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
123
+ 3. Cover your changes with tests and make sure they're green (`bundle install && bundle exec rake test`)
124
+ 4. Commit your changes (`git commit -am 'Add some feature'`)
125
+ 5. Push to the branch (`git push origin my-new-feature`)
126
+ 6. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.libs << 'test'
6
+ t.test_files = FileList['test/lib/omniauth/**/*_test.rb']
7
+ t.verbose = true
8
+ end
9
+
10
+ task default: :test
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OmniAuth
4
+ module OpenIDConnect
5
+ class Error < RuntimeError; end
6
+ class MissingCodeError < Error; end
7
+ class MissingIdTokenError < Error; end
8
+ end
9
+ end