Class: SMARTAppLaunch::BackendServicesAuthorizationRequestBuilder
- Inherits:
-
Object
- Object
- SMARTAppLaunch::BackendServicesAuthorizationRequestBuilder
- Defined in:
- lib/smart_app_launch/backend_services_authorization_request_builder.rb
Instance Attribute Summary collapse
-
#aud ⇒ Object
readonly
Returns the value of attribute aud.
-
#client_assertion_type ⇒ Object
readonly
Returns the value of attribute client_assertion_type.
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
-
#custom_jwks ⇒ Object
readonly
Returns the value of attribute custom_jwks.
-
#encryption_method ⇒ Object
readonly
Returns the value of attribute encryption_method.
-
#exp ⇒ Object
readonly
Returns the value of attribute exp.
-
#grant_type ⇒ Object
readonly
Returns the value of attribute grant_type.
-
#iss ⇒ Object
readonly
Returns the value of attribute iss.
-
#jti ⇒ Object
readonly
Returns the value of attribute jti.
-
#kid ⇒ Object
readonly
Returns the value of attribute kid.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
-
#sub ⇒ Object
readonly
Returns the value of attribute sub.
Class Method Summary collapse
Instance Method Summary collapse
- #authorization_request ⇒ Object
- #authorization_request_headers ⇒ Object
- #authorization_request_query_values ⇒ Object
- #client_assertion ⇒ Object
-
#initialize(encryption_method:, scope:, iss:, sub:, aud:, content_type: 'application/x-www-form-urlencoded', grant_type: 'client_credentials', client_assertion_type: 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer', exp: 5.minutes.from_now, jti: SecureRandom.hex(32), kid: nil, custom_jwks: nil) ⇒ BackendServicesAuthorizationRequestBuilder
constructor
A new instance of BackendServicesAuthorizationRequestBuilder.
Constructor Details
#initialize(encryption_method:, scope:, iss:, sub:, aud:, content_type: 'application/x-www-form-urlencoded', grant_type: 'client_credentials', client_assertion_type: 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer', exp: 5.minutes.from_now, jti: SecureRandom.hex(32), kid: nil, custom_jwks: nil) ⇒ BackendServicesAuthorizationRequestBuilder
Returns a new instance of BackendServicesAuthorizationRequestBuilder.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/smart_app_launch/backend_services_authorization_request_builder.rb', line 23 def initialize( encryption_method:, scope:, iss:, sub:, aud:, content_type: 'application/x-www-form-urlencoded', grant_type: 'client_credentials', client_assertion_type: 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer', exp: 5.minutes.from_now, jti: SecureRandom.hex(32), kid: nil, custom_jwks: nil ) @encryption_method = encryption_method @scope = scope @iss = iss @sub = sub @aud = aud @content_type = content_type @grant_type = grant_type @client_assertion_type = client_assertion_type @exp = exp @jti = jti @kid = kid @custom_jwks = custom_jwks end |
Instance Attribute Details
#aud ⇒ Object (readonly)
Returns the value of attribute aud.
10 11 12 |
# File 'lib/smart_app_launch/backend_services_authorization_request_builder.rb', line 10 def aud @aud end |
#client_assertion_type ⇒ Object (readonly)
Returns the value of attribute client_assertion_type.
10 11 12 |
# File 'lib/smart_app_launch/backend_services_authorization_request_builder.rb', line 10 def client_assertion_type @client_assertion_type end |
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
10 11 12 |
# File 'lib/smart_app_launch/backend_services_authorization_request_builder.rb', line 10 def content_type @content_type end |
#custom_jwks ⇒ Object (readonly)
Returns the value of attribute custom_jwks.
10 11 12 |
# File 'lib/smart_app_launch/backend_services_authorization_request_builder.rb', line 10 def custom_jwks @custom_jwks end |
#encryption_method ⇒ Object (readonly)
Returns the value of attribute encryption_method.
10 11 12 |
# File 'lib/smart_app_launch/backend_services_authorization_request_builder.rb', line 10 def encryption_method @encryption_method end |
#exp ⇒ Object (readonly)
Returns the value of attribute exp.
10 11 12 |
# File 'lib/smart_app_launch/backend_services_authorization_request_builder.rb', line 10 def exp @exp end |
#grant_type ⇒ Object (readonly)
Returns the value of attribute grant_type.
10 11 12 |
# File 'lib/smart_app_launch/backend_services_authorization_request_builder.rb', line 10 def grant_type @grant_type end |
#iss ⇒ Object (readonly)
Returns the value of attribute iss.
10 11 12 |
# File 'lib/smart_app_launch/backend_services_authorization_request_builder.rb', line 10 def iss @iss end |
#jti ⇒ Object (readonly)
Returns the value of attribute jti.
10 11 12 |
# File 'lib/smart_app_launch/backend_services_authorization_request_builder.rb', line 10 def jti @jti end |
#kid ⇒ Object (readonly)
Returns the value of attribute kid.
10 11 12 |
# File 'lib/smart_app_launch/backend_services_authorization_request_builder.rb', line 10 def kid @kid end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
10 11 12 |
# File 'lib/smart_app_launch/backend_services_authorization_request_builder.rb', line 10 def scope @scope end |
#sub ⇒ Object (readonly)
Returns the value of attribute sub.
10 11 12 |
# File 'lib/smart_app_launch/backend_services_authorization_request_builder.rb', line 10 def sub @sub end |
Class Method Details
.build ⇒ Object
6 7 8 |
# File 'lib/smart_app_launch/backend_services_authorization_request_builder.rb', line 6 def self.build(...) new(...). end |
Instance Method Details
#authorization_request ⇒ Object
80 81 82 83 84 85 |
# File 'lib/smart_app_launch/backend_services_authorization_request_builder.rb', line 80 def uri = Addressable::URI.new uri.query_values = { body: uri.query, headers: } end |
#authorization_request_headers ⇒ Object
51 52 53 54 55 56 |
# File 'lib/smart_app_launch/backend_services_authorization_request_builder.rb', line 51 def { content_type:, accept: 'application/json' }.compact end |
#authorization_request_query_values ⇒ Object
58 59 60 61 62 63 64 65 |
# File 'lib/smart_app_launch/backend_services_authorization_request_builder.rb', line 58 def { 'scope' => scope, 'grant_type' => grant_type, 'client_assertion_type' => client_assertion_type, 'client_assertion' => client_assertion.to_s }.compact end |
#client_assertion ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/smart_app_launch/backend_services_authorization_request_builder.rb', line 67 def client_assertion @client_assertion ||= ClientAssertionBuilder.build( client_auth_encryption_method: encryption_method, iss:, sub:, aud:, exp: exp.to_i, jti:, kid:, custom_jwks: ) end |