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
# File 'lib/soar/authentication/identity/test/orchestration_provider/stub.rb', line 12

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

Instance Method Details

#given_authenticated_identifierNil

Returns:

  • (Nil)


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

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)


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

def given_existing_identity

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

  @directory.put(@entry)
end

#request_uuidNil

Returns:

  • (Nil)


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

def request_uuid
  @identity.uuid
end

#role?Boolean

Returns:

  • (Boolean)


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

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

#uuid?Boolean

Returns:

  • (Boolean)


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

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