Class: Soar::Authentication::Identity::Test::OrchestrationProvider::Stub

Inherits:
Object
  • Object
show all
Defined in:
lib/soar/authentication/identity/test/orchestration_provider/stub.rb

Instance Method Summary collapse

Constructor Details

#initializeStub

Returns a new instance of Stub.



12
13
14
15
16
17
18
19
# File 'lib/soar/authentication/identity/test/orchestration_provider/stub.rb', line 12

def initialize()
  directory_provider = Soar::Registry::Directory::Provider::Stub.new({
    table: "mytable",
    primary_key: "uuid",
    index: ["uuid", "identifier"] 
  })
  @directory = Soar::Registry::Directory.new(directory_provider)
end

Instance Method Details

#given_authenticated_identifierNil

Returns:

  • (Nil)


37
38
39
40
41
42
43
# File 'lib/soar/authentication/identity/test/orchestration_provider/stub.rb', line 37

def given_authenticated_identifier
  identity_provider = Soar::Authentication::Identity::Provider::Stub.new({
    directory: @directory,
    authenticated_identifier: @entry['identifier']
  })
  @identity = Soar::Authentication::Identity::new(identity_provider)
end

#given_existing_identityNil

Returns:

  • (Nil)


24
25
26
27
28
29
30
31
32
# File 'lib/soar/authentication/identity/test/orchestration_provider/stub.rb', line 24

def given_existing_identity

  @entry = {
    "uuid" => SecureRandom.uuid,
    "identifier" => '[email protected]'
  }

  @directory.put(@entry)
end

#request_uuidNil

Returns:

  • (Nil)


48
49
50
# File 'lib/soar/authentication/identity/test/orchestration_provider/stub.rb', line 48

def request_uuid
  @identity.uuid
end

#role?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/soar/authentication/identity/test/orchestration_provider/stub.rb', line 59

def role?
  @identity.role == 'stub'
end

#uuid?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/soar/authentication/identity/test/orchestration_provider/stub.rb', line 55

def uuid?
  @entry["uuid"] == @identity.uuid
end