Class: SignIn::ServiceAccountAccessTokenJwtEncoder

Inherits:
Object
  • Object
show all
Defined in:
app/services/sign_in/service_account_access_token_jwt_encoder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(service_account_access_token:) ⇒ ServiceAccountAccessTokenJwtEncoder

Returns a new instance of ServiceAccountAccessTokenJwtEncoder.



7
8
9
# File 'app/services/sign_in/service_account_access_token_jwt_encoder.rb', line 7

def initialize(service_account_access_token:)
  @service_account_access_token = 
end

Instance Attribute Details

#service_account_access_tokenObject (readonly)

Returns the value of attribute service_account_access_token.



5
6
7
# File 'app/services/sign_in/service_account_access_token_jwt_encoder.rb', line 5

def 
  @service_account_access_token
end

Instance Method Details

#jwt_encode_service_account_access_tokenObject (private)



17
18
19
# File 'app/services/sign_in/service_account_access_token_jwt_encoder.rb', line 17

def 
  JWT.encode(payload, private_key, Constants::ServiceAccountAccessToken::JWT_ENCODE_ALGORITHM)
end

#payloadObject (private)



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/services/sign_in/service_account_access_token_jwt_encoder.rb', line 21

def payload
  {
    iss: Constants::ServiceAccountAccessToken::ISSUER,
    aud: .audience,
    jti: .uuid,
    sub: .user_identifier,
    exp: .expiration_time.to_i,
    iat: .created_time.to_i,
    nbf: .created_time.to_i,
    version: .version,
    scopes: .scopes,
    service_account_id: .,
    user_attributes: .user_attributes
  }
end

#performObject



11
12
13
# File 'app/services/sign_in/service_account_access_token_jwt_encoder.rb', line 11

def perform
  
end

#private_keyObject (private)



37
38
39
# File 'app/services/sign_in/service_account_access_token_jwt_encoder.rb', line 37

def private_key
  OpenSSL::PKey::RSA.new(File.read(Settings..jwt_encode_key))
end