File: auth_helper.rb

package info (click to toggle)
ruby-fog-openstack 1.0.8-2.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 5,132 kB
  • sloc: ruby: 36,411; makefile: 5; sh: 4
file content (102 lines) | stat: -rw-r--r-- 2,835 bytes parent folder | download | duplicates (2)
1
2
3
4
5
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
def auth_response_v3(type, name)
  {
    'token' => {
      'methods'    => ['password'],
      'roles'      => [{
        'id'   => 'id_roles',
        'name' => 'admin'
      }],
      'expires_at' => '2017-11-29T07:45:29.908554Z',
      'project'    => {
        'domain' => {
          'id'   => 'default',
          'name' => 'Default'
        },
        'id'     => 'project_id',
        'name'   => 'admin'
      },
      'catalog'    => [{
        'endpoints' => [
          {
            'region_id' => 'regionOne',
            'url'       => 'http://localhost',
            'region'    => 'regionOne',
            'interface' => 'internal',
            'id'        => 'id_endpoint_internal'
          },
          {
            'region_id' => 'regionOne',
            'url'       => 'http://localhost',
            'region'    => 'regionOne',
            'interface' => 'public',
            'id'        => 'id_endpoint_public'
          },
          {
            'region_id' => 'regionOne',
            'url'       => 'http://localhost',
            'region'    => 'regionOne',
            'interface' => 'admin',
            'id'        => 'id_endpoint_admin'
          }
        ],
        'type'      => type,
        'id'        => 'id_endpoints',
        'name'      => name
      }],
      'user'       => {
        'domain' => {
          'id'   => 'default',
          'name' => 'Default'
        },
        'id'     => 'id_user',
        'name'   => 'admin'
      },
      'audit_ids'  => ['id_audits'],
      'issued_at'  => '2017-11-29T06:45:29.908578Z'
    }
  }
end

def auth_response_v2(type, name)
  {
    'access' => {
      'token'          => {
        'issued_at' => '2017-12-05T10:44:31.454741Z',
        'expires'   => '2017-12-05T11:44:31Z',
        'id'        => '4ae647d3a5294690a3c29bc658e17e26',
        'tenant'    => {
          'description' => 'admin tenant',
          'enabled'     => true,
          'id'          => 'tenant_id',
          'name'        => 'admin'
        },
        'audit_ids' => ['Ye0Rq1HzTk2ggUAg8nDGbQ']
      },
      'serviceCatalog' => [{
        'endpoints'       => [{
          'adminURL'    => 'http://localhost',
          'region'      => 'regionOne',
          'internalURL' => 'http://localhost',
          'id'          => 'id_endpoints',
          'publicURL'   => 'http://localhost'
        }],
        'endpoints_links' => [],
        'type'            => type,
        'name'            => name
      }],
      'user'           => {
        'username'    => 'admin',
        'roles_links' => [],
        'id'          => 'user_id',
        'roles'       => [{
          'name' => 'admin'
        }],
        'name'        => 'admin'
      },
      'metadata'       => {
        'is_admin' => 0,
        'roles'    => ['role_id']
      }
    }
  }
end