Class: UDAPSecurityTestKit::SoftwareStatementBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/udap_security_test_kit/software_statement_builder.rb

Class Method Summary collapse

Class Method Details

.build_payload(iss, aud, grant_type, scope) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/udap_security_test_kit/software_statement_builder.rb', line 6

def self.build_payload(iss, aud, grant_type, scope)
  if grant_type == 'authorization_code'
    redirect_uris = [UDAPSecurityTestKit::UDAP_REDIRECT_URI]
    response_types = ['code']
    client_name = 'Inferno UDAP Authorization Code Test Client'
  elsif grant_type == 'client_credentials'
    client_name = 'Inferno UDAP Client Credentials Test Client'
  end

  {
    iss:,
    sub: iss,
    aud:,
    exp: 5.minutes.from_now.to_i,
    iat: Time.now.to_i,
    jti: SecureRandom.hex(32),
    client_name:,
    redirect_uris:,
    contacts: ['mailto:[email protected]'],
    logo_uri: 'https://inferno-framework.github.io/assets/inferno_logo.png',
    grant_types: [grant_type],
    response_types:,
    token_endpoint_auth_method: 'private_key_jwt',
    scope:
  }.compact
end