Class: StytchB2B::SSO::External

Inherits:
Object
  • Object
show all
Includes:
Stytch::RequestHelper
Defined in:
lib/stytch/b2b_sso.rb

Defined Under Namespace

Classes: CreateConnectionRequestOptions, UpdateConnectionRequestOptions

Instance Method Summary collapse

Methods included from Stytch::RequestHelper

#delete_request, #get_request, #post_request, #put_request, #request_with_query_params

Constructor Details

#initialize(connection) ⇒ External

Returns a new instance of External.



812
813
814
# File 'lib/stytch/b2b_sso.rb', line 812

def initialize(connection)
  @connection = connection
end

Instance Method Details

#create_connection(organization_id:, external_organization_id:, external_connection_id:, display_name: nil, connection_implicit_role_assignments: nil, group_implicit_role_assignments: nil, method_options: nil) ⇒ Object

Create a new External SSO 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.

external_organization_id

Globally unique UUID that identifies a different Organization within your Project. The type of this field is String.

external_connection_id

Globally unique UUID that identifies a specific SSO connection configured for a different Organization in your Project. 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.

connection_implicit_role_assignments

(no documentation yet) The type of this field is nilable list of SAMLConnectionImplicitRoleAssignment.

group_implicit_role_assignments

(no documentation yet) The type of this field is nilable list of SAMLGroupImplicitRoleAssignment.

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 ‘External Connection` object affected by this API call. See the [External Connection Object](stytch.com/docs/b2b/api/external-connection-object) for complete response field details. The type of this field is nilable Connection (object).

Method Options:

This method supports an optional StytchB2B::SSO::External::CreateConnectionRequestOptions object which will modify the headers sent in the HTTP request.



852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
# File 'lib/stytch/b2b_sso.rb', line 852

def create_connection(
  organization_id:,
  external_organization_id:,
  external_connection_id:,
  display_name: nil,
  connection_implicit_role_assignments: nil,
  group_implicit_role_assignments: nil,
  method_options: nil
)
  headers = {}
  headers = headers.merge(method_options.to_headers) unless method_options.nil?
  request = {
    external_organization_id: external_organization_id,
    external_connection_id: external_connection_id
  }
  request[:display_name] = display_name unless display_name.nil?
  request[:connection_implicit_role_assignments] = connection_implicit_role_assignments unless connection_implicit_role_assignments.nil?
  request[:group_implicit_role_assignments] = group_implicit_role_assignments unless group_implicit_role_assignments.nil?

  post_request("/v1/b2b/sso/external/#{organization_id}", request, headers)
end

#update_connection(organization_id:, connection_id:, display_name: nil, external_connection_implicit_role_assignments: nil, external_group_implicit_role_assignments: nil, method_options: nil) ⇒ Object

Updates an existing External SSO 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 External SSO 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.

external_connection_implicit_role_assignments

All Members who log in with this External connection will implicitly receive the specified Roles. See the [RBAC guide](stytch.com/docs/b2b/guides/rbac/role-assignment) for more information about role assignment. Implicit role assignments are not supported for External connections if the underlying SSO connection is an OIDC connection. The type of this field is nilable list of ConnectionImplicitRoleAssignment.

external_group_implicit_role_assignments

Defines the names of the groups

that grant specific role assignments. For each group-Role pair, if a Member logs in with this external connection and
belongs to the specified group, they will be granted the associated Role. See the
[RBAC guide](https://stytch.com/docs/b2b/guides/rbac/role-assignment) for more information about role assignment. Before adding any group implicit role assignments to an external connection, you must add a "groups" key to the underlying SAML connection's
        `attribute_mapping`. Make sure that the SAML connection IdP is configured to correctly send the group information. Implicit role assignments are not supported
        for External connections if the underlying SSO connection is an OIDC connection.
 The type of this field is nilable list of +GroupImplicitRoleAssignment+.

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 ‘External Connection` object affected by this API call. See the [External Connection Object](stytch.com/docs/b2b/api/external-connection-object) for complete response field details. The type of this field is nilable Connection (object).

Method Options:

This method supports an optional StytchB2B::SSO::External::UpdateConnectionRequestOptions object which will modify the headers sent in the HTTP request.



912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
# File 'lib/stytch/b2b_sso.rb', line 912

def update_connection(
  organization_id:,
  connection_id:,
  display_name: nil,
  external_connection_implicit_role_assignments: nil,
  external_group_implicit_role_assignments: nil,
  method_options: nil
)
  headers = {}
  headers = headers.merge(method_options.to_headers) unless method_options.nil?
  request = {}
  request[:display_name] = display_name unless display_name.nil?
  request[:external_connection_implicit_role_assignments] = external_connection_implicit_role_assignments unless external_connection_implicit_role_assignments.nil?
  request[:external_group_implicit_role_assignments] = external_group_implicit_role_assignments unless external_group_implicit_role_assignments.nil?

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