Skip to content

Commit

Permalink
apply syntax_tree formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaylorhq committed Oct 16, 2024
1 parent d61d3df commit 8e1426a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/openid_connect_authenticator.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true
require 'base64'
require 'openssl'
require "base64"
require "openssl"

class OpenIDConnectAuthenticator < Auth::ManagedAuthenticator
def name
Expand Down Expand Up @@ -112,9 +112,11 @@ def register_middleware(omniauth)
pkce: SiteSetting.openid_connect_use_pkce,
pkce_options: {
code_verifier: -> { generate_code_verifier },
code_challenge: -> (code_verifier) { generate_code_challenge(code_verifier) },
code_challenge_method: 'S256'
}
code_challenge: ->(code_verifier) do
generate_code_challenge(code_verifier)
end,
code_challenge_method: "S256",
},
)

opts[:client_options][:connection_opts] = {
Expand All @@ -137,13 +139,11 @@ def register_middleware(omniauth)
end

def generate_code_verifier
Base64.urlsafe_encode64(OpenSSL::Random.random_bytes(32)).tr('=', '')
Base64.urlsafe_encode64(OpenSSL::Random.random_bytes(32)).tr("=", "")
end

def generate_code_challenge(code_verifier)
Base64.urlsafe_encode64(
Digest::SHA256.digest(code_verifier)
).tr('+/', '-_').tr('=', '')
Base64.urlsafe_encode64(Digest::SHA256.digest(code_verifier)).tr("+/", "-_").tr("=", "")
end

def request_timeout_seconds
Expand Down

0 comments on commit 8e1426a

Please sign in to comment.