Class: Safire::ClientConfigBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/safire/client_config_builder.rb

Overview

ClientConfigBuilder helps to build a Safire::ClientConfig instance

Instance Method Summary collapse

Constructor Details

#initializeClientConfigBuilder

Returns a new instance of ClientConfigBuilder.



4
5
6
# File 'lib/safire/client_config_builder.rb', line 4

def initialize
  @config = {}
end

Instance Method Details

#authorization_endpoint(authorization_endpoint) ⇒ Object



38
39
40
41
# File 'lib/safire/client_config_builder.rb', line 38

def authorization_endpoint(authorization_endpoint)
  @config[:authorization_endpoint] = authorization_endpoint
  self
end

#base_url(url) ⇒ Object



8
9
10
11
# File 'lib/safire/client_config_builder.rb', line 8

def base_url(url)
  @config[:base_url] = url
  self
end

#buildObject



68
69
70
# File 'lib/safire/client_config_builder.rb', line 68

def build
  Safire::ClientConfig.new(@config)
end

#client_id(client_id) ⇒ Object



18
19
20
21
# File 'lib/safire/client_config_builder.rb', line 18

def client_id(client_id)
  @config[:client_id] = client_id
  self
end

#client_secret(client_secret) ⇒ Object



23
24
25
26
# File 'lib/safire/client_config_builder.rb', line 23

def client_secret(client_secret)
  @config[:client_secret] = client_secret
  self
end

#issuer(issuer) ⇒ Object



13
14
15
16
# File 'lib/safire/client_config_builder.rb', line 13

def issuer(issuer)
  @config[:issuer] = issuer
  self
end

#jwks_uri(jwks_uri) ⇒ Object



63
64
65
66
# File 'lib/safire/client_config_builder.rb', line 63

def jwks_uri(jwks_uri)
  @config[:jwks_uri] = jwks_uri
  self
end

#jwt_algorithm(jwt_algorithm) ⇒ Object



58
59
60
61
# File 'lib/safire/client_config_builder.rb', line 58

def jwt_algorithm(jwt_algorithm)
  @config[:jwt_algorithm] = jwt_algorithm
  self
end

#kid(kid) ⇒ Object



53
54
55
56
# File 'lib/safire/client_config_builder.rb', line 53

def kid(kid)
  @config[:kid] = kid
  self
end

#private_key(private_key) ⇒ Object



48
49
50
51
# File 'lib/safire/client_config_builder.rb', line 48

def private_key(private_key)
  @config[:private_key] = private_key
  self
end

#redirect_uri(uri) ⇒ Object



28
29
30
31
# File 'lib/safire/client_config_builder.rb', line 28

def redirect_uri(uri)
  @config[:redirect_uri] = uri
  self
end

#scopes(scopes) ⇒ Object



33
34
35
36
# File 'lib/safire/client_config_builder.rb', line 33

def scopes(scopes)
  @config[:scopes] = scopes
  self
end

#token_endpoint(token_endpoint) ⇒ Object



43
44
45
46
# File 'lib/safire/client_config_builder.rb', line 43

def token_endpoint(token_endpoint)
  @config[:token_endpoint] = token_endpoint
  self
end