Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Allowed OAuth Tenants #334

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion dist/b2b/organizations.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions dist/b2c/m2m.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions lib/b2b/discovery_organizations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,21 @@ export interface B2BDiscoveryOrganizationsCreateRequest {
*
*/
allowed_mfa_methods?: string[];
/**
* The authentication setting that controls how a new Member can JIT provision into an organization by
* tenant. The accepted values are:
*
* `RESTRICTED` – only new Members with tenants in `allowed_oauth_tenants` can JIT provision via tenant.
*
* `NOT_ALLOWED` – disable JIT provisioning by OAuth Tenant.
*
*/
oauth_tenant_jit_provisioning?: string;
/**
* A map of allowed OAuth tenants. If this field is not passed in, the Organization will not allow JIT
* provisioning by OAuth Tenant. Allowed keys are "slack" and "hubspot".
*/
allowed_oauth_tenants?: Record<string, any>; // eslint-disable-line @typescript-eslint/no-explicit-any
}

// Response type for `discovery.organizations.create`.
Expand Down
55 changes: 55 additions & 0 deletions lib/b2b/organizations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,16 @@ export interface Organization {
*
*/
allowed_mfa_methods: string[];
/**
* The authentication setting that controls how a new Member can JIT provision into an organization by
* tenant. The accepted values are:
*
* `RESTRICTED` – only new Members with tenants in `allowed_oauth_tenants` can JIT provision via tenant.
*
* `NOT_ALLOWED` – disable JIT provisioning by OAuth Tenant.
*
*/
oauth_tenant_jit_provisioning: string;
// An arbitrary JSON object for storing application-specific data or identity-provider-specific data.
trusted_metadata?: Record<string, any>; // eslint-disable-line @typescript-eslint/no-explicit-any
/**
Expand All @@ -445,6 +455,11 @@ export interface Organization {
sso_default_connection_id?: string;
// An active [SCIM Connection references](https://stytch.com/docs/b2b/api/scim-connection-object).
scim_active_connection?: ActiveSCIMConnection;
/**
* A map of allowed OAuth tenants. If this field is not passed in, the Organization will not allow JIT
* provisioning by OAuth Tenant. Allowed keys are "slack" and "hubspot".
*/
allowed_oauth_tenants?: Record<string, any>; // eslint-disable-line @typescript-eslint/no-explicit-any
}

export interface RetiredEmail {
Expand Down Expand Up @@ -606,6 +621,21 @@ export interface B2BOrganizationsCreateRequest {
*
*/
allowed_mfa_methods?: string[];
/**
* The authentication setting that controls how a new Member can JIT provision into an organization by
* tenant. The accepted values are:
*
* `RESTRICTED` – only new Members with tenants in `allowed_oauth_tenants` can JIT provision via tenant.
*
* `NOT_ALLOWED` – disable JIT provisioning by OAuth Tenant.
*
*/
oauth_tenant_jit_provisioning?: string;
/**
* A map of allowed OAuth tenants. If this field is not passed in, the Organization will not allow JIT
* provisioning by OAuth Tenant. Allowed keys are "slack" and "hubspot".
*/
allowed_oauth_tenants?: Record<string, any>; // eslint-disable-line @typescript-eslint/no-explicit-any
}

// Response type for `organizations.create`.
Expand Down Expand Up @@ -927,6 +957,29 @@ export interface B2BOrganizationsUpdateRequest {
* Resource.
*/
allowed_mfa_methods?: string[];
/**
* The authentication setting that controls how a new Member can JIT provision into an organization by
* tenant. The accepted values are:
*
* `RESTRICTED` – only new Members with tenants in `allowed_oauth_tenants` can JIT provision via tenant.
*
* `NOT_ALLOWED` – disable JIT provisioning by OAuth Tenant.
*
*
* If this field is provided and a session header is passed into the request, the Member Session must have
* permission to perform the `update.settings.oauth-tenant-jit-provisioning` action on the
* `stytch.organization` Resource.
*/
oauth_tenant_jit_provisioning?: string;
/**
* A map of allowed OAuth tenants. If this field is not passed in, the Organization will not allow JIT
* provisioning by OAuth Tenant. Allowed keys are "slack" and "hubspot".
*
* If this field is provided and a session header is passed into the request, the Member Session must have
* permission to perform the `update.settings.allowed-oauth-tenants` action on the `stytch.organization`
* Resource.
*/
allowed_oauth_tenants?: Record<string, any>; // eslint-disable-line @typescript-eslint/no-explicit-any
}

// Response type for `organizations.update`.
Expand Down Expand Up @@ -1121,6 +1174,8 @@ export class Organizations {
data.rbac_email_implicit_role_assignments,
mfa_methods: data.mfa_methods,
allowed_mfa_methods: data.allowed_mfa_methods,
oauth_tenant_jit_provisioning: data.oauth_tenant_jit_provisioning,
allowed_oauth_tenants: data.allowed_oauth_tenants,
},
});
}
Expand Down
26 changes: 13 additions & 13 deletions lib/b2c/m2m.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,19 +241,19 @@ export class M2M {
// ADDIMPORT: import { performAuthorizationCheck, ScopeAuthorizationFunc } from "./m2m_local";
// ADDIMPORT: import { ClientError } from "../shared/errors";
/**
* Authenticate an access token issued by Stytch from the Token endpoint.
* M2M access tokens are JWTs signed with the project's JWKs, and can be validated locally using any Stytch client library.
* You may pass in an optional set of scopes that the JWT must contain in order to enforce permissions.
* You may also override the default scope authorization function to implement custom authorization logic.
*
* @param data {@link AuthenticateTokenRequest}
* @param scopeAuthorizationFunc {@link ScopeAuthorizationFunc} - A function that checks if the token has the required scopes.
The default function assumes scopes are either direct string matches or written in the form "action:resource". See the
documentation for {@link performAuthorizationCheck} for more information.
* @async
* @returns {@link AuthenticateTokenResponse}
* @throws {ClientError} when token can not be authenticated
*/
* Authenticate an access token issued by Stytch from the Token endpoint.
* M2M access tokens are JWTs signed with the project's JWKs, and can be validated locally using any Stytch client library.
* You may pass in an optional set of scopes that the JWT must contain in order to enforce permissions.
* You may also override the default scope authorization function to implement custom authorization logic.
*
* @param data {@link AuthenticateTokenRequest}
* @param scopeAuthorizationFunc {@link ScopeAuthorizationFunc} - A function that checks if the token has the required scopes.
The default function assumes scopes are either direct string matches or written in the form "action:resource". See the
documentation for {@link performAuthorizationCheck} for more information.
* @async
* @returns {@link AuthenticateTokenResponse}
* @throws {ClientError} when token can not be authenticated
*/
Comment on lines +244 to +256
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm... looks like codegen is forcing this section to slowly march right off the page. I'll file a task to look into why it's doing this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BACK-3893

async authenticateToken(
data: AuthenticateTokenRequest,
scopeAuthorizationFunc: ScopeAuthorizationFunc = performAuthorizationCheck
Expand Down
15 changes: 15 additions & 0 deletions types/lib/b2b/discovery_organizations.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions types/lib/b2b/organizations.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions types/lib/b2c/m2m.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading