DEV: General cleanup (#34)

This commit is contained in:
Jarek Radosz 2022-04-06 12:19:39 +02:00 committed by GitHub
parent dfcdc38d77
commit e897702139
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 1184 additions and 862 deletions

View File

@ -50,7 +50,10 @@ jobs:
- name: Ember template lint - name: Ember template lint
if: ${{ always() }} if: ${{ always() }}
run: yarn ember-template-lint assets/javascripts run: |
if [ 0 -lt $(find assets/javascripts -type f -name "*.hbs" 2> /dev/null | wc -l) ]; then
yarn ember-template-lint assets/javascripts
fi
- name: Rubocop - name: Rubocop
if: ${{ always() }} if: ${{ always() }}

View File

@ -1,31 +1,31 @@
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
ast (2.4.1) ast (2.4.2)
parallel (1.19.2) parallel (1.22.1)
parser (2.7.2.0) parser (3.1.1.0)
ast (~> 2.4.1) ast (~> 2.4.1)
rainbow (3.0.0) rainbow (3.1.1)
regexp_parser (1.8.1) regexp_parser (2.2.1)
rexml (3.2.5) rexml (3.2.5)
rubocop (0.93.0) rubocop (1.26.1)
parallel (~> 1.10) parallel (~> 1.10)
parser (>= 2.7.1.5) parser (>= 3.1.0.0)
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8) regexp_parser (>= 1.8, < 3.0)
rexml rexml
rubocop-ast (>= 0.6.0) rubocop-ast (>= 1.16.0, < 2.0)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0) unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (0.7.1) rubocop-ast (1.16.0)
parser (>= 2.7.1.5) parser (>= 3.1.1.0)
rubocop-discourse (2.3.2) rubocop-discourse (2.5.0)
rubocop (>= 0.69.0) rubocop (>= 1.1.0)
rubocop-rspec (>= 1.39.0) rubocop-rspec (>= 2.0.0)
rubocop-rspec (1.43.2) rubocop-rspec (2.9.0)
rubocop (~> 0.87) rubocop (~> 1.19)
ruby-progressbar (1.10.1) ruby-progressbar (1.11.0)
unicode-display_width (1.7.0) unicode-display_width (2.1.0)
PLATFORMS PLATFORMS
ruby ruby

View File

@ -22,13 +22,13 @@ plugins:
openid_connect_token_scope: openid_connect_token_scope:
default: "" default: ""
openid_connect_error_redirects: openid_connect_error_redirects:
default: '' default: ""
type: list type: list
list_type: secret list_type: secret
openid_connect_authorize_parameters: openid_connect_authorize_parameters:
default: '' default: ""
type: list type: list
list_type: compact list_type: compact
openid_connect_claims: openid_connect_claims:
default: '' default: ""
textarea: true textarea: true

View File

@ -206,7 +206,6 @@ module ::OmniAuth
response = client.request(:post, options[:client_options][:token_url], body: get_token_options) response = client.request(:post, options[:client_options][:token_url], body: get_token_options)
::OAuth2::AccessToken.from_hash(client, response.parsed) ::OAuth2::AccessToken.from_hash(client, response.parsed)
end end
end end
end end
end end

View File

@ -1,4 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
class OpenIDConnectAuthenticator < Auth::ManagedAuthenticator class OpenIDConnectAuthenticator < Auth::ManagedAuthenticator
def name def name
'oidc' 'oidc'
@ -64,7 +65,6 @@ class OpenIDConnectAuthenticator < Auth::ManagedAuthenticator
end end
def register_middleware(omniauth) def register_middleware(omniauth)
omniauth.provider :openid_connect, omniauth.provider :openid_connect,
name: :oidc, name: :oidc,
error_handler: lambda { |error, message| error_handler: lambda { |error, message|

View File

@ -1,6 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
require 'faraday/logging/formatter' require 'faraday/logging/formatter'
class OIDCFaradayFormatter < Faraday::Logging::Formatter class OIDCFaradayFormatter < Faraday::Logging::Formatter
def request(env) def request(env)
warn <<~LOG warn <<~LOG

View File

@ -1,10 +1,10 @@
{ {
"name": "discourse-openid-connect", "name": "discourse-openid-connect",
"version": "1.0.0", "version": "1.0.0",
"repository": "git@github.com:discourse/discourse-openid-connect.git", "repository": "https://github.com/discourse/discourse-openid-connect",
"author": "Discourse", "author": "Discourse",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"eslint-config-discourse": "^1.1.3" "eslint-config-discourse": "^3.0.0"
} }
} }

View File

@ -5,6 +5,7 @@
# version: 1.0 # version: 1.0
# authors: David Taylor # authors: David Taylor
# url: https://github.com/discourse/discourse-openid-connect # url: https://github.com/discourse/discourse-openid-connect
# transpile_js: true
enabled_site_setting :openid_connect_enabled enabled_site_setting :openid_connect_enabled

View File

@ -202,5 +202,4 @@ describe OmniAuth::Strategies::OpenIDConnect do
end end
end end
end end
end end

View File

@ -5,8 +5,9 @@ require_relative '../../lib/omniauth_open_id_connect'
describe OpenIDConnectAuthenticator do describe OpenIDConnectAuthenticator do
let(:authenticator) { described_class.new } let(:authenticator) { described_class.new }
let(:user) { Fabricate(:user) } fab!(:user) { Fabricate(:user) }
let(:hash) { OmniAuth::AuthHash.new( let(:hash) do
OmniAuth::AuthHash.new(
provider: "oidc", provider: "oidc",
uid: "123456789", uid: "123456789",
info: { info: {
@ -19,7 +20,8 @@ describe OpenIDConnectAuthenticator do
name: "John Doe" name: "John Doe"
} }
} }
)} )
end
context "when email_verified is not supplied" do context "when email_verified is not supplied" do
# Some IDPs do not supply this information # Some IDPs do not supply this information
@ -109,7 +111,5 @@ describe OpenIDConnectAuthenticator do
expect(authenticator.discovery_document).to eq(nil) expect(authenticator.discovery_document).to eq(nil)
expect(stub).to have_been_requested.once expect(stub).to have_been_requested.once
end end
end end
end end

View File

@ -13,7 +13,7 @@ describe "OIDC RP-Initiated Logout" do
"end_session_endpoint": "https://id.example.com/endsession", "end_session_endpoint": "https://id.example.com/endsession",
} }
end end
let(:user) { Fabricate(:user) } fab!(:user) { Fabricate(:user) }
before do before do
SiteSetting.openid_connect_enabled = true SiteSetting.openid_connect_enabled = true
@ -96,7 +96,5 @@ describe "OIDC RP-Initiated Logout" do
expect(response.status).to eq(200) expect(response.status).to eq(200)
expect(response.parsed_body["redirect_url"]).to eq("/") expect(response.parsed_body["redirect_url"]).to eq("/")
end end
end end
end end

1945
yarn.lock

File diff suppressed because it is too large Load Diff