module Simpleokta::Client::AuthServers

Public Instance Methods

activate_auth_server(auth_server_id) click to toggle source

Activate an Authorization Server in the okta instance. @param auth_server_id [String] the unique id of the authorization server @return 204 No Content @see developer.okta.com/docs/reference/api/authorization-servers/#activate-authorization-server Activate Authorization Server

# 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) click to toggle source

Get an Authorization Server in the okta instance. @param auth_server_id [String] The unique id of the authorization server @return [Hash<Authorization Server Object>] @see developer.okta.com/docs/reference/api/authorization-servers/#authorization-server-object Authorization Server Object

# 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_servers() click to toggle source

Return all Authorization Servers in the okta instance. @return [Array<Authorization Server Object>] @see developer.okta.com/docs/reference/api/authorization-servers/#authorization-server-object Authorization Server Object

# 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) click to toggle source

Create an Authorization Server in the okta instance. @param auth_server_data [Hash] The Authorization Server Object you want to create @return [Hash<Authorization Server Object>] @see developer.okta.com/docs/reference/api/authorization-servers/#create-authorization-server Create Authorization Server @see developer.okta.com/docs/reference/api/authorization-servers/#authorization-server-object Authorization Server Object

# 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) click to toggle source

Create a Policy for a given Authorization Server @param auth_server_id [String] the unique id of the authorization server @param policy_data [Hash<Policy Object>] the data for the expected Policy @return [Hash<Policy Object>] @see developer.okta.com/docs/reference/api/authorization-servers/#policy-object Policy Object @see developer.okta.com/docs/reference/api/authorization-servers/#create-a-policy Create Policy

# 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) click to toggle source

Deactivate an Authorization Server in the okta instance. @param auth_server_id [String] the unique id of the authorization server @return 204 No Content @see developer.okta.com/docs/reference/api/authorization-servers/#activate-authorization-server Deactivate Authorization Server

# 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) click to toggle source

Delete an Authorization Server in the okta instance. @param auth_server_id [String] the unique id of the authorization server @return 204 No Content @see developer.okta.com/docs/reference/api/authorization-servers/#delete-authorization-server Delete Authorization Server

# 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) click to toggle source

Delete a Policy for a given Authorization Server @param auth_server_id [String] the unique id of the authorization server @param policy_id [String] the unique id of the policy @return 204 No Content @see developer.okta.com/docs/reference/api/authorization-servers/#policy-object Policy Object @see developer.okta.com/docs/reference/api/authorization-servers/#delete-a-policy Delete Policy

# 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) click to toggle source

Return all Policies attached to a given Authorization Server in the okta instance. @param auth_server_id [String] the unique id of the authorization server @return [Array<Policy Object>] @see developer.okta.com/docs/reference/api/authorization-servers/#policy-object Policy Object

# 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) click to toggle source

Return a specific Policy for a given Authorization Server in the okta instance. @param auth_server_id [String] the unique id of the authorization server @param policy_id [String] the unique id of the policy @return [Hash<Policy Object>] @see developer.okta.com/docs/reference/api/authorization-servers/#policy-object Policy Object @see developer.okta.com/docs/reference/api/authorization-servers/#get-a-policy Get Policy

# 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) click to toggle source

Update an Authorization Server in the okta instance. @param auth_server_id [String] The unique id of the authorization server @param auth_server_data [Hash] The Authorization Server Object you want to update @return [Hash<Authorization Server Object>] @see developer.okta.com/docs/reference/api/authorization-servers/#update-authorization-server Update Authorization Server @see developer.okta.com/docs/reference/api/authorization-servers/#authorization-server-object Authorization Server Object

# 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) click to toggle source

Update a Policy for a given Authorization Server @param auth_server_id [String] the unique id of the authorization server @param policy_id [String] the unique id of the policy @param policy_data [Hash<Policy Object>] the new data for the Policy @return [Hash<Policy Object>] @see developer.okta.com/docs/reference/api/authorization-servers/#policy-object Policy Object @see developer.okta.com/docs/reference/api/authorization-servers/#update-a-policy Update Policy

# 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