Skip to content

Commit

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

* scim
  • Loading branch information
ollie-stytch authored Mar 29, 2024
1 parent e95fcf2 commit b1f21f7
Show file tree
Hide file tree
Showing 6 changed files with 497 additions and 1 deletion.
2 changes: 2 additions & 0 deletions stytch/b2b/b2bstytchapi/b2bstytchapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type API struct {
Passwords *b2b.PasswordsClient
RBAC *b2b.RBACClient
RecoveryCodes *b2b.RecoveryCodesClient
SCIM *b2b.SCIMClient
SSO *b2b.SSOClient
Sessions *b2b.SessionsClient
TOTPs *b2b.TOTPsClient
Expand Down Expand Up @@ -149,6 +150,7 @@ func NewClient(projectID string, secret string, opts ...Option) (*API, error) {
a.Passwords = b2b.NewPasswordsClient(a.client)
a.RBAC = b2b.NewRBACClient(a.client)
a.RecoveryCodes = b2b.NewRecoveryCodesClient(a.client)
a.SCIM = b2b.NewSCIMClient(a.client)
a.SSO = b2b.NewSSOClient(a.client)
a.Sessions = b2b.NewSessionsClient(a.client, jwks, policyCache)
a.TOTPs = b2b.NewTOTPsClient(a.client)
Expand Down
24 changes: 24 additions & 0 deletions stytch/b2b/scim.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package b2b

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

import (
"github.com/stytchauth/stytch-go/v12/stytch"
)

type SCIMClient struct {
C stytch.Client
Connections *SCIMConnectionsClient
}

func NewSCIMClient(c stytch.Client) *SCIMClient {
return &SCIMClient{
C: c,

Connections: NewSCIMConnectionsClient(c),
}
}
200 changes: 200 additions & 0 deletions stytch/b2b/scim/connections/types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
package connections

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

import (
"github.com/stytchauth/stytch-go/v12/stytch/b2b/scim"
)

// CreateParams: Request type for `Connections.Create`.
type CreateParams struct {
// OrganizationID: 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.
OrganizationID string `json:"organization_id,omitempty"`
// DisplayName: A human-readable display name for the connection.
DisplayName string `json:"display_name,omitempty"`
IdentityProvider CreateRequestIdp `json:"idp,omitempty"`
}

// DeleteParams: Request type for `Connections.Delete`.
type DeleteParams struct {
// OrganizationID: 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.
OrganizationID string `json:"organization_id,omitempty"`
// ConnectionID: Globally unique UUID that identifies a specific SSO `connection_id` for a Member.
ConnectionID string `json:"connection_id,omitempty"`
}

// GetParams: Request type for `Connections.Get`.
type GetParams struct {
// OrganizationID: 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.
OrganizationID string `json:"organization_id,omitempty"`
}

// RotateCancelParams: Request type for `Connections.RotateCancel`.
type RotateCancelParams struct {
// OrganizationID: 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.
OrganizationID string `json:"organization_id,omitempty"`
// ConnectionID: The ID of the SCIM connection.
ConnectionID string `json:"connection_id,omitempty"`
}

// RotateCompleteParams: Request type for `Connections.RotateComplete`.
type RotateCompleteParams struct {
// OrganizationID: 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.
OrganizationID string `json:"organization_id,omitempty"`
// ConnectionID: The ID of the SCIM connection.
ConnectionID string `json:"connection_id,omitempty"`
}

// RotateStartParams: Request type for `Connections.RotateStart`.
type RotateStartParams struct {
// OrganizationID: 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.
OrganizationID string `json:"organization_id,omitempty"`
// ConnectionID: The ID of the SCIM connection.
ConnectionID string `json:"connection_id,omitempty"`
}

// UpdateParams: Request type for `Connections.Update`.
type UpdateParams struct {
// OrganizationID: 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.
OrganizationID string `json:"organization_id,omitempty"`
// ConnectionID: The ID of the SCIM connection.
ConnectionID string `json:"connection_id,omitempty"`
// DisplayName: A human-readable display name for the connection.
DisplayName string `json:"display_name,omitempty"`
IdentityProvider UpdateRequestIdp `json:"idp,omitempty"`
SCIMGroupImplicitRoleAssignments []*scim.SCIMGroupImplicitRoleAssignments `json:"scim_group_implicit_role_assignments,omitempty"`
}

// CreateResponse: Response type for `Connections.Create`.
type CreateResponse struct {
// RequestID: 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.
RequestID string `json:"request_id,omitempty"`
// StatusCode: 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.
StatusCode int32 `json:"status_code,omitempty"`
// 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.
Connection *scim.SCIMConnectionWithToken `json:"connection,omitempty"`
}

// DeleteResponse: Response type for `Connections.Delete`.
type DeleteResponse struct {
// RequestID: 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.
RequestID string `json:"request_id,omitempty"`
// ConnectionID: The `connection_id` that was deleted as part of the delete request.
ConnectionID string `json:"connection_id,omitempty"`
// StatusCode: 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.
StatusCode int32 `json:"status_code,omitempty"`
}

// GetResponse: Response type for `Connections.Get`.
type GetResponse struct {
// RequestID: 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.
RequestID string `json:"request_id,omitempty"`
Connections []scim.SCIMConnection `json:"connections,omitempty"`
// StatusCode: 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.
StatusCode int32 `json:"status_code,omitempty"`
}

// RotateCancelResponse: Response type for `Connections.RotateCancel`.
type RotateCancelResponse struct {
// RequestID: 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.
RequestID string `json:"request_id,omitempty"`
// StatusCode: 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.
StatusCode int32 `json:"status_code,omitempty"`
// 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.
Connection *scim.SCIMConnection `json:"connection,omitempty"`
}

// RotateCompleteResponse: Response type for `Connections.RotateComplete`.
type RotateCompleteResponse struct {
// RequestID: 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.
RequestID string `json:"request_id,omitempty"`
// StatusCode: 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.
StatusCode int32 `json:"status_code,omitempty"`
// 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.
Connection *scim.SCIMConnection `json:"connection,omitempty"`
}

// RotateStartResponse: Response type for `Connections.RotateStart`.
type RotateStartResponse struct {
// RequestID: 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.
RequestID string `json:"request_id,omitempty"`
// StatusCode: 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.
StatusCode int32 `json:"status_code,omitempty"`
// 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.
Connection *scim.SCIMConnectionWithNextToken `json:"connection,omitempty"`
}

// UpdateResponse: Response type for `Connections.Update`.
type UpdateResponse struct {
// RequestID: 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.
RequestID string `json:"request_id,omitempty"`
// StatusCode: 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.
StatusCode int32 `json:"status_code,omitempty"`
// 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.
Connection *scim.SCIMConnection `json:"connection,omitempty"`
}

type CreateRequestIdp string

const (
CreateRequestIdpUnknown CreateRequestIdp = "unknown"
CreateRequestIdpOkta CreateRequestIdp = "okta"
CreateRequestIdpMicrosoftentra CreateRequestIdp = "microsoft-entra"
)

type UpdateRequestIdp string

const (
UpdateRequestIdpUnknown UpdateRequestIdp = "unknown"
UpdateRequestIdpOkta UpdateRequestIdp = "okta"
UpdateRequestIdpMicrosoftentra UpdateRequestIdp = "microsoft-entra"
)
55 changes: 55 additions & 0 deletions stytch/b2b/scim/types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package scim

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

import (
"time"
)

type SCIMConnection struct {
OrganizationID string `json:"organization_id,omitempty"`
ConnectionID string `json:"connection_id,omitempty"`
Status string `json:"status,omitempty"`
DisplayName string `json:"display_name,omitempty"`
IdentityProvider string `json:"idp,omitempty"`
BaseURL string `json:"base_url,omitempty"`
BearerTokenLastFour string `json:"bearer_token_last_four,omitempty"`
SCIMGroupImplicitRoleAssignments []SCIMGroupImplicitRoleAssignments `json:"scim_group_implicit_role_assignments,omitempty"`
BearerTokenExpiresAt *time.Time `json:"bearer_token_expires_at,omitempty"`
}

type SCIMConnectionWithNextToken struct {
OrganizationID string `json:"organization_id,omitempty"`
ConnectionID string `json:"connection_id,omitempty"`
Status string `json:"status,omitempty"`
DisplayName string `json:"display_name,omitempty"`
BaseURL string `json:"base_url,omitempty"`
IdentityProvider string `json:"idp,omitempty"`
BearerTokenLastFour string `json:"bearer_token_last_four,omitempty"`
NextBearerToken string `json:"next_bearer_token,omitempty"`
SCIMGroupImplicitRoleAssignments []SCIMGroupImplicitRoleAssignments `json:"scim_group_implicit_role_assignments,omitempty"`
BearerTokenExpiresAt *time.Time `json:"bearer_token_expires_at,omitempty"`
NextBearerTokenExpiresAt *time.Time `json:"next_bearer_token_expires_at,omitempty"`
}

type SCIMConnectionWithToken struct {
OrganizationID string `json:"organization_id,omitempty"`
ConnectionID string `json:"connection_id,omitempty"`
Status string `json:"status,omitempty"`
DisplayName string `json:"display_name,omitempty"`
IdentityProvider string `json:"idp,omitempty"`
BaseURL string `json:"base_url,omitempty"`
BearerToken string `json:"bearer_token,omitempty"`
SCIMGroupImplicitRoleAssignments []SCIMGroupImplicitRoleAssignments `json:"scim_group_implicit_role_assignments,omitempty"`
BearerTokenExpiresAt *time.Time `json:"bearer_token_expires_at,omitempty"`
}

type SCIMGroupImplicitRoleAssignments struct {
RoleID string `json:"role_id,omitempty"`
GroupID string `json:"group_id,omitempty"`
GroupName string `json:"group_name,omitempty"`
}
Loading

0 comments on commit b1f21f7

Please sign in to comment.