Module: Simpleokta::Client::AuthServers

Included in:
Simpleokta::Client
Defined in:
lib/simpleokta/auth_servers.rb

Instance Method Summary collapse

Instance Method Details

#activate_auth_server(auth_server_id) ⇒ Object

Activate an Authorization Server in the okta instance.

Parameters:

  • auth_server_id (String)

    the unique id of the authorization server

Returns:

  • 204 No Content

See Also:



75
76
77
78
79
80
# File 'lib/simpleokta/auth_servers.rb', line 75

def activate_auth_server(auth_server_id)
  call_with_token(
    'post',
    "#{Constants::AUTH_SERVER_API_BASE_PATH}/#{auth_server_id}/lifecycle/activate"
  )
end

#auth_server(auth_server_id) ⇒ Hash<Authorization Server Object>

Get an Authorization Server in the okta instance.

Parameters:

  • auth_server_id (String)

    The unique id of the authorization server

Returns:

  • (Hash<Authorization Server Object>)

See Also:



12
13
14
15
16
17
18
# File 'lib/simpleokta/auth_servers.rb', line 12

def auth_server(auth_server_id)
  response = call_with_token(
    'get',
    "#{Constants::AUTH_SERVER_API_BASE_PATH}/#{auth_server_id}"
  )
  JSON.parse(response.body)
end

#auth_serversArray<Authorization Server Object>

Return all Authorization Servers in the okta instance.

Returns:

  • (Array<Authorization Server Object>)

See Also:



23
24
25
26
27
28
29
# File 'lib/simpleokta/auth_servers.rb', line 23

def auth_servers
  response = call_with_token(
    'get',
    Constants::AUTH_SERVER_API_BASE_PATH
  )
  JSON.parse(response.body)
end

#create_auth_server(auth_server_data) ⇒ Hash<Authorization Server Object>

Create an Authorization Server in the okta instance.

Parameters:

  • auth_server_data (Hash)

    The Authorization Server Object you want to create

Returns:

  • (Hash<Authorization Server Object>)

See Also:



36
37
38
39
40
41
42
43
# File 'lib/simpleokta/auth_servers.rb', line 36

def create_auth_server(auth_server_data)
  response = call_with_token(
    'post',
    Constants::AUTH_SERVER_API_BASE_PATH,
    auth_server_data
  )
  JSON.parse(response.body)
end

#create_policy(auth_server_id, policy_data) ⇒ Hash<Policy Object>

Create a Policy for a given Authorization Server

Parameters:

  • auth_server_id (String)

    the unique id of the authorization server

  • policy_data (Hash<Policy Object>)

    the data for the expected Policy

Returns:

  • (Hash<Policy Object>)

See Also:



127
128
129
130
131
132
133
134
# File 'lib/simpleokta/auth_servers.rb', line 127

def create_policy(auth_server_id, policy_data)
  response = call_with_token(
    'post',
    "#{Constants::AUTH_SERVER_API_BASE_PATH}/#{auth_server_id}/policies",
    policy_data
  )
  JSON.parse(response.body)
end

#deactivate_auth_server(auth_server_id) ⇒ Object

Deactivate an Authorization Server in the okta instance.

Parameters:

  • auth_server_id (String)

    the unique id of the authorization server

Returns:

  • 204 No Content

See Also:



86
87
88
89
90
91
# File 'lib/simpleokta/auth_servers.rb', line 86

def deactivate_auth_server(auth_server_id)
  call_with_token(
    'post',
    "#{Constants::AUTH_SERVER_API_BASE_PATH}/#{auth_server_id}/lifecycle/deactivate"
  )
end

#delete_auth_server(auth_server_id) ⇒ Object

Delete an Authorization Server in the okta instance.

Parameters:

  • auth_server_id (String)

    the unique id of the authorization server

Returns:

  • 204 No Content

See Also:



64
65
66
67
68
69
# File 'lib/simpleokta/auth_servers.rb', line 64

def delete_auth_server(auth_server_id)
  call_with_token(
    'delete',
    "#{Constants::AUTH_SERVER_API_BASE_PATH}/#{auth_server_id}"
  )
end

#delete_policy(auth_server_id, policy_id) ⇒ Object

Delete a Policy for a given Authorization Server

Parameters:

  • auth_server_id (String)

    the unique id of the authorization server

  • policy_id (String)

    the unique id of the policy

Returns:

  • 204 No Content

See Also:



158
159
160
161
162
163
# File 'lib/simpleokta/auth_servers.rb', line 158

def delete_policy(auth_server_id, policy_id)
  call_with_token(
    'delete',
    "#{Constants::AUTH_SERVER_API_BASE_PATH}/#{auth_server_id}/policies/#{policy_id}"
  )
end

#policies(auth_server_id) ⇒ Array<Policy Object>

Return all Policies attached to a given Authorization Server in the okta instance.

Parameters:

  • auth_server_id (String)

    the unique id of the authorization server

Returns:

  • (Array<Policy Object>)

See Also:



99
100
101
102
103
104
105
# File 'lib/simpleokta/auth_servers.rb', line 99

def policies(auth_server_id)
  response = call_with_token(
    'get',
    "#{Constants::AUTH_SERVER_API_BASE_PATH}/#{auth_server_id}/policies"
  )
  JSON.parse(response.body)
end

#policy(auth_server_id, _policy_id) ⇒ Hash<Policy Object>

Return a specific Policy for a given Authorization Server in the okta instance.

Parameters:

  • auth_server_id (String)

    the unique id of the authorization server

  • policy_id (String)

    the unique id of the policy

Returns:

  • (Hash<Policy Object>)

See Also:



113
114
115
116
117
118
119
# File 'lib/simpleokta/auth_servers.rb', line 113

def policy(auth_server_id, _policy_id)
  response = call_with_token(
    'get',
    "#{Constants::AUTH_SERVER_API_BASE_PATH}/#{auth_server_id}/policies"
  )
  JSON.parse(response.body)
end

#update_auth_server(auth_server_id, auth_server_data) ⇒ Hash<Authorization Server Object>

Update an Authorization Server in the okta instance.

Parameters:

  • auth_server_id (String)

    The unique id of the authorization server

  • auth_server_data (Hash)

    The Authorization Server Object you want to update

Returns:

  • (Hash<Authorization Server Object>)

See Also:



51
52
53
54
55
56
57
58
# File 'lib/simpleokta/auth_servers.rb', line 51

def update_auth_server(auth_server_id, auth_server_data)
  response = call_with_token(
    'put',
    "#{Constants::AUTH_SERVER_API_BASE_PATH}/#{auth_server_id}",
    auth_server_data
  )
  JSON.parse(response.body)
end

#update_policy(auth_server_id, policy_id, policy_data) ⇒ Hash<Policy Object>

Update a Policy for a given Authorization Server

Parameters:

  • auth_server_id (String)

    the unique id of the authorization server

  • policy_id (String)

    the unique id of the policy

  • policy_data (Hash<Policy Object>)

    the new data for the Policy

Returns:

  • (Hash<Policy Object>)

See Also:



143
144
145
146
147
148
149
150
# File 'lib/simpleokta/auth_servers.rb', line 143

def update_policy(auth_server_id, policy_id, policy_data)
  response = call_with_token(
    'put',
    "#{Constants::AUTH_SERVER_API_BASE_PATH}/#{auth_server_id}/policies/#{policy_id}",
    policy_data
  )
  JSON.parse(response.body)
end