Class: SignIn::StatePayload

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
app/models/sign_in/state_payload.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(acr:, client_id:, type:, code:, scope: nil, code_challenge: nil, client_state: nil, created_at: nil) ⇒ StatePayload

rubocop:disable Metrics/ParameterLists



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'app/models/sign_in/state_payload.rb', line 26

def initialize(acr:,
               client_id:,
               type:,
               code:,
               scope: nil,
               code_challenge: nil,
               client_state: nil,
               created_at: nil)
  @acr = acr
  @client_id = client_id
  @type = type
  @code_challenge = code_challenge
  @client_state = client_state
  @code = code
  @scope = scope
  @created_at = created_at || Time.zone.now.to_i

  validate!
end

Instance Attribute Details

#acrObject (readonly)

Returns the value of attribute acr.



7
8
9
# File 'app/models/sign_in/state_payload.rb', line 7

def acr
  @acr
end

#client_idObject (readonly)

Returns the value of attribute client_id.



7
8
9
# File 'app/models/sign_in/state_payload.rb', line 7

def client_id
  @client_id
end

#client_stateObject (readonly)

Returns the value of attribute client_state.



7
8
9
# File 'app/models/sign_in/state_payload.rb', line 7

def client_state
  @client_state
end

#codeObject (readonly)

Returns the value of attribute code.



7
8
9
# File 'app/models/sign_in/state_payload.rb', line 7

def code
  @code
end

#code_challengeObject (readonly)

Returns the value of attribute code_challenge.



7
8
9
# File 'app/models/sign_in/state_payload.rb', line 7

def code_challenge
  @code_challenge
end

#created_atObject (readonly)

Returns the value of attribute created_at.



7
8
9
# File 'app/models/sign_in/state_payload.rb', line 7

def created_at
  @created_at
end

#scopeObject (readonly)

Returns the value of attribute scope.



7
8
9
# File 'app/models/sign_in/state_payload.rb', line 7

def scope
  @scope
end

#typeObject (readonly)

Returns the value of attribute type.



7
8
9
# File 'app/models/sign_in/state_payload.rb', line 7

def type
  @type
end

Instance Method Details

#confirm_client_idObject (private)



53
54
55
# File 'app/models/sign_in/state_payload.rb', line 53

def confirm_client_id
  errors.add(:base, 'Client id must map to a configuration') unless ClientConfig.valid_client_id?(client_id:)
end

#persisted?Boolean

rubocop:enable Metrics/ParameterLists

Returns:

  • (Boolean)


47
48
49
# File 'app/models/sign_in/state_payload.rb', line 47

def persisted?
  false
end