Skip to content

Commit

Permalink
SCIM support (#120)
Browse files Browse the repository at this point in the history
* minor version bump

* SCIM

* SCIM
  • Loading branch information
ollie-stytch authored Apr 1, 2024
1 parent 2e1ec79 commit a6dbea7
Show file tree
Hide file tree
Showing 3 changed files with 266 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/stytch/b2b_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
require_relative 'b2b_passwords'
require_relative 'b2b_rbac'
require_relative 'b2b_recovery_codes'
require_relative 'b2b_scim'
require_relative 'b2b_sessions'
require_relative 'b2b_sso'
require_relative 'b2b_totps'
Expand All @@ -18,7 +19,7 @@ module StytchB2B
class Client
ENVIRONMENTS = %i[live test].freeze

attr_reader :discovery, :m2m, :magic_links, :oauth, :otps, :organizations, :passwords, :rbac, :recovery_codes, :sso, :sessions, :totps
attr_reader :discovery, :m2m, :magic_links, :oauth, :otps, :organizations, :passwords, :rbac, :recovery_codes, :scim, :sso, :sessions, :totps

def initialize(project_id:, secret:, env: nil, &block)
@api_host = api_host(env, project_id)
Expand All @@ -39,6 +40,7 @@ def initialize(project_id:, secret:, env: nil, &block)
@passwords = StytchB2B::Passwords.new(@connection)
@rbac = StytchB2B::RBAC.new(@connection)
@recovery_codes = StytchB2B::RecoveryCodes.new(@connection)
@scim = StytchB2B::SCIM.new(@connection)
@sso = StytchB2B::SSO.new(@connection)
@sessions = StytchB2B::Sessions.new(@connection, @project_id, @policy_cache)
@totps = StytchB2B::TOTPs.new(@connection)
Expand Down
262 changes: 262 additions & 0 deletions lib/stytch/b2b_scim.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,262 @@
# frozen_string_literal: true

# !!!
# WARNING: This file is autogenerated
# Only modify code within MANUAL() sections
# or your changes may be overwritten later!
# !!!

require_relative 'request_helper'

module StytchB2B
class SCIM
include Stytch::RequestHelper
attr_reader :connections

def initialize(connection)
@connection = connection

@connections = StytchB2B::SCIM::Connections.new(@connection)
end

class Connections
include Stytch::RequestHelper

def initialize(connection)
@connection = connection
end

# Update a SCIM Connection. /%}
#
# == Parameters:
# organization_id::
# Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value.
# The type of this field is +String+.
# connection_id::
# The ID of the SCIM connection.
# The type of this field is +String+.
# display_name::
# A human-readable display name for the connection.
# The type of this field is nilable +String+.
# identity_provider::
# (no documentation yet)
# The type of this field is nilable +UpdateRequestIdp+ (string enum).
# scim_group_implicit_role_assignments::
# (no documentation yet)
# The type of this field is nilable list of +SCIMGroupImplicitRoleAssignments+.
#
# == Returns:
# An object with the following fields:
# request_id::
# Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
# The type of this field is +String+.
# status_code::
# The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
# The type of this field is +Integer+.
# connection::
# The `SAML Connection` object affected by this API call. See the [SAML Connection Object](https://stytch.com/docs/b2b/api/saml-connection-object) for complete response field details.
# The type of this field is nilable +SCIMConnection+ (+object+).
def update(
organization_id:,
connection_id:,
display_name: nil,
identity_provider: nil,
scim_group_implicit_role_assignments: nil
)
headers = {}
request = {}
request[:display_name] = display_name unless display_name.nil?
request[:identity_provider] = identity_provider unless identity_provider.nil?
request[:scim_group_implicit_role_assignments] = scim_group_implicit_role_assignments unless scim_group_implicit_role_assignments.nil?

put_request("/v1/b2b/scim/#{organization_id}/connections/#{connection_id}", request, headers)
end

# Deletes a SCIM Connection. /%}
#
# == Parameters:
# organization_id::
# Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value.
# The type of this field is +String+.
# connection_id::
# Globally unique UUID that identifies a specific SSO `connection_id` for a Member.
# The type of this field is +String+.
#
# == Returns:
# An object with the following fields:
# request_id::
# Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
# The type of this field is +String+.
# connection_id::
# The `connection_id` that was deleted as part of the delete request.
# The type of this field is +String+.
# status_code::
# The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
# The type of this field is +Integer+.
def delete(
organization_id:,
connection_id:
)
headers = {}
delete_request("/v1/b2b/scim/#{organization_id}/connections/#{connection_id}", headers)
end

# Start a SCIM token rotation. /%}
#
# == Parameters:
# organization_id::
# Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value.
# The type of this field is +String+.
# connection_id::
# The ID of the SCIM connection.
# The type of this field is +String+.
#
# == Returns:
# An object with the following fields:
# request_id::
# Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
# The type of this field is +String+.
# status_code::
# The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
# The type of this field is +Integer+.
# connection::
# The `SCIM Connection` object affected by this API call. See the [SCIM Connection Object](https://stytch.com/docs/b2b/api/scim-connection-object) for complete response field details.
# The type of this field is nilable +SCIMConnectionWithNextToken+ (+object+).
def rotate_start(
organization_id:,
connection_id:
)
headers = {}
request = {}

post_request("/v1/b2b/scim/#{organization_id}/connections/#{connection_id}/rotate/start", request, headers)
end

# Completes a SCIM token rotation. This will complete the current token rotation process and update the active token to be the new token supplied in the [start SCIM token rotation](https://stytch.com/docs/b2b/api/scim-rotate-token-start) response. /%}
#
# == Parameters:
# organization_id::
# Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value.
# The type of this field is +String+.
# connection_id::
# The ID of the SCIM connection.
# The type of this field is +String+.
#
# == Returns:
# An object with the following fields:
# request_id::
# Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
# The type of this field is +String+.
# status_code::
# The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
# The type of this field is +Integer+.
# connection::
# The `SCIM Connection` object affected by this API call. See the [SCIM Connection Object](https://stytch.com/docs/b2b/api/scim-connection-object) for complete response field details.
# The type of this field is nilable +SCIMConnection+ (+object+).
def rotate_complete(
organization_id:,
connection_id:
)
headers = {}
request = {}

post_request("/v1/b2b/scim/#{organization_id}/connections/#{connection_id}/rotate/complete", request, headers)
end

# Cancel a SCIM token rotation. This will cancel the current token rotation process, keeping the original token active. /%}
#
# == Parameters:
# organization_id::
# Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value.
# The type of this field is +String+.
# connection_id::
# The ID of the SCIM connection.
# The type of this field is +String+.
#
# == Returns:
# An object with the following fields:
# request_id::
# Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
# The type of this field is +String+.
# status_code::
# The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
# The type of this field is +Integer+.
# connection::
# The `SCIM Connection` object affected by this API call. See the [SCIM Connection Object](https://stytch.com/docs/b2b/api/scim-connection-object) for complete response field details.
# The type of this field is nilable +SCIMConnection+ (+object+).
def rotate_cancel(
organization_id:,
connection_id:
)
headers = {}
request = {}

post_request("/v1/b2b/scim/#{organization_id}/connections/#{connection_id}/rotate/cancel", request, headers)
end

# Create a new SCIM Connection. /%}
#
# == Parameters:
# organization_id::
# Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value.
# The type of this field is +String+.
# display_name::
# A human-readable display name for the connection.
# The type of this field is nilable +String+.
# identity_provider::
# (no documentation yet)
# The type of this field is nilable +CreateRequestIdp+ (string enum).
#
# == Returns:
# An object with the following fields:
# request_id::
# Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
# The type of this field is +String+.
# status_code::
# The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
# The type of this field is +Integer+.
# connection::
# The `SCIM Connection` object affected by this API call. See the [SCIM Connection Object](https://stytch.com/docs/b2b/api/scim-connection-object) for complete response field details.
# The type of this field is nilable +SCIMConnectionWithToken+ (+object+).
def create(
organization_id:,
display_name: nil,
identity_provider: nil
)
headers = {}
request = {}
request[:display_name] = display_name unless display_name.nil?
request[:identity_provider] = identity_provider unless identity_provider.nil?

post_request("/v1/b2b/scim/#{organization_id}/connections", request, headers)
end

# Get SCIM Connections. /%}
#
# == Parameters:
# organization_id::
# Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value.
# The type of this field is +String+.
#
# == Returns:
# An object with the following fields:
# request_id::
# Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
# The type of this field is +String+.
# connections::
# (no documentation yet)
# The type of this field is list of +SCIMConnection+ (+object+).
# status_code::
# The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
# The type of this field is +Integer+.
def get(
organization_id:
)
headers = {}
query_params = {}
request = request_with_query_params("/v1/b2b/scim/#{organization_id}/connections", query_params)
get_request(request, headers)
end
end
end
end
2 changes: 1 addition & 1 deletion lib/stytch/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Stytch
VERSION = '7.5.1'
VERSION = '7.6.0'
end

0 comments on commit a6dbea7

Please sign in to comment.