Class: CognitoIdp::AuthorizationUri

Inherits:
Object
  • Object
show all
Defined in:
lib/cognito_idp/authorization_uri.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client_id:, domain:, redirect_uri:, response_type: :code, **options) ⇒ AuthorizationUri

Returns a new instance of AuthorizationUri.



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/cognito_idp/authorization_uri.rb', line 9

def initialize(client_id:, domain:, redirect_uri:, response_type: :code, **options)
  @code_challenge_method = options[:code_challenge_method]
  @code_challenge = options[:code_challenge]
  @client_id = client_id
  @domain = domain
  @identity_provider = options[:identity_provider]
  @idp_identifier = options[:idp_identifier]
  @nonce = options[:nonce]
  @redirect_uri = redirect_uri
  @response_type = response_type
  @scope = options[:scope]
  @state = options[:state]
end

Instance Attribute Details

#client_idObject

Returns the value of attribute client_id.



5
6
7
# File 'lib/cognito_idp/authorization_uri.rb', line 5

def client_id
  @client_id
end

#code_challengeObject

Returns the value of attribute code_challenge.



5
6
7
# File 'lib/cognito_idp/authorization_uri.rb', line 5

def code_challenge
  @code_challenge
end

#code_challenge_methodObject

Returns the value of attribute code_challenge_method.



5
6
7
# File 'lib/cognito_idp/authorization_uri.rb', line 5

def code_challenge_method
  @code_challenge_method
end

#domainObject

Returns the value of attribute domain.



5
6
7
# File 'lib/cognito_idp/authorization_uri.rb', line 5

def domain
  @domain
end

#identity_providerObject

Returns the value of attribute identity_provider.



5
6
7
# File 'lib/cognito_idp/authorization_uri.rb', line 5

def identity_provider
  @identity_provider
end

#idp_identifierObject

Returns the value of attribute idp_identifier.



5
6
7
# File 'lib/cognito_idp/authorization_uri.rb', line 5

def idp_identifier
  @idp_identifier
end

#nonceObject

Returns the value of attribute nonce.



5
6
7
# File 'lib/cognito_idp/authorization_uri.rb', line 5

def nonce
  @nonce
end

#redirect_uriObject

Returns the value of attribute redirect_uri.



5
6
7
# File 'lib/cognito_idp/authorization_uri.rb', line 5

def redirect_uri
  @redirect_uri
end

#response_typeObject

Returns the value of attribute response_type.



5
6
7
# File 'lib/cognito_idp/authorization_uri.rb', line 5

def response_type
  @response_type
end

#scopeObject

Returns the value of attribute scope.



5
6
7
# File 'lib/cognito_idp/authorization_uri.rb', line 5

def scope
  @scope
end

#stateObject

Returns the value of attribute state.



5
6
7
# File 'lib/cognito_idp/authorization_uri.rb', line 5

def state
  @state
end

Instance Method Details

#to_sObject



23
24
25
26
27
# File 'lib/cognito_idp/authorization_uri.rb', line 23

def to_s
  URI("https://#{domain}/oauth2/authorize").tap do |uri|
    uri.query = URI.encode_www_form(params)
  end.to_s
end