Class: UDAPSecurityTestKit::UDAPRequestBuilder
- Inherits:
-
Object
- Object
- UDAPSecurityTestKit::UDAPRequestBuilder
- Defined in:
- lib/udap_security_test_kit/udap_request_builder.rb
Class Method Summary collapse
- .build_registration_request(software_statement_jwt, certifications_jwt) ⇒ Object
- .build_token_exchange_request(client_assertion_jwt, grant_type, authorization_code, redirect_uri) ⇒ Object
Class Method Details
.build_registration_request(software_statement_jwt, certifications_jwt) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/udap_security_test_kit/udap_request_builder.rb', line 4 def self.build_registration_request(software_statement_jwt, certifications_jwt) registration_headers = { 'Accept' => 'application/json', 'Content-Type' => 'application/json' } certifications = if certifications_jwt.nil? [] else certifications_jwt.split end registration_body = { 'software_statement' => software_statement_jwt, 'certifications' => certifications, 'udap' => '1' }.compact [registration_headers, registration_body.to_json] end |
.build_token_exchange_request(client_assertion_jwt, grant_type, authorization_code, redirect_uri) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/udap_security_test_kit/udap_request_builder.rb', line 25 def self.build_token_exchange_request(client_assertion_jwt, grant_type, , redirect_uri) token_exchange_headers = { 'Accept' => 'application/json', 'Content-Type' => 'application/x-www-form-urlencoded' } token_exchange_body = { 'grant_type' => grant_type, 'code' => , 'redirect_uri' => redirect_uri, 'client_assertion_type' => 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer', 'client_assertion' => client_assertion_jwt, 'udap' => '1' }.compact [token_exchange_headers, URI.encode_www_form(token_exchange_body)] end |