diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/organizationsmembers/OrganizationsMembers.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/organizationsmembers/OrganizationsMembers.kt index 993c4e3..91117d5 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/organizationsmembers/OrganizationsMembers.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/organizationsmembers/OrganizationsMembers.kt @@ -313,13 +313,31 @@ public interface Members { */ public fun dangerouslyGetCompletable(data: DangerouslyGetRequest): CompletableFuture> + /** + * Retrieve the saved OIDC access tokens and ID tokens for a member. After a successful OIDC login, Stytch will save the + * issued access token and ID token from the identity provider. If a refresh token has been issued, Stytch will refresh + * the + * access token automatically. + */ public suspend fun oidcProviders(data: OIDCProviderInformationRequest): StytchResult + /** + * Retrieve the saved OIDC access tokens and ID tokens for a member. After a successful OIDC login, Stytch will save the + * issued access token and ID token from the identity provider. If a refresh token has been issued, Stytch will refresh + * the + * access token automatically. + */ public fun oidcProviders( data: OIDCProviderInformationRequest, callback: (StytchResult) -> Unit, ) + /** + * Retrieve the saved OIDC access tokens and ID tokens for a member. After a successful OIDC login, Stytch will save the + * issued access token and ID token from the identity provider. If a refresh token has been issued, Stytch will refresh + * the + * access token automatically. + */ public fun oidcProvidersCompletable(data: OIDCProviderInformationRequest): CompletableFuture> /** diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/otpsms/OTPSms.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/otpsms/OTPSms.kt index 9ab27c9..f477b98 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/otpsms/OTPSms.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/otpsms/OTPSms.kt @@ -34,7 +34,8 @@ public interface Sms { * An error will be thrown if the Member already has a phone number and the provided `mfa_phone_number` does not match the * existing one. * - * Note that sending another OTP code before the first has expired will invalidate the first code. + * OTP codes expire after two minutes. Note that sending another OTP code before the first has expired will invalidate the + * first code. * * If a Member has a phone number and is enrolled in MFA, then after a successful primary authentication event (e.g. * [email magic link](https://stytch.com/docs/b2b/api/authenticate-magic-link) or @@ -70,7 +71,8 @@ public interface Sms { * An error will be thrown if the Member already has a phone number and the provided `mfa_phone_number` does not match the * existing one. * - * Note that sending another OTP code before the first has expired will invalidate the first code. + * OTP codes expire after two minutes. Note that sending another OTP code before the first has expired will invalidate the + * first code. * * If a Member has a phone number and is enrolled in MFA, then after a successful primary authentication event (e.g. * [email magic link](https://stytch.com/docs/b2b/api/authenticate-magic-link) or @@ -109,7 +111,8 @@ public interface Sms { * An error will be thrown if the Member already has a phone number and the provided `mfa_phone_number` does not match the * existing one. * - * Note that sending another OTP code before the first has expired will invalidate the first code. + * OTP codes expire after two minutes. Note that sending another OTP code before the first has expired will invalidate the + * first code. * * If a Member has a phone number and is enrolled in MFA, then after a successful primary authentication event (e.g. * [email magic link](https://stytch.com/docs/b2b/api/authenticate-magic-link) or @@ -138,9 +141,11 @@ public interface Sms { * SMS OTPs may not be used as a primary authentication mechanism. They can be used to complete an MFA requirement, or * they can be used as a step-up factor to be added to an existing session. * - * This endpoint verifies that the one-time passcode (OTP) is valid and hasn't expired or been previously used. A given - * Member may only have a single active OTP code at any given time. If a Member requests another OTP code before the first - * one has expired, the first one will be invalidated. + * This endpoint verifies that the one-time passcode (OTP) is valid and hasn't expired or been previously used. OTP codes + * expire after two minutes. + * + * A given Member may only have a single active OTP code at any given time. If a Member requests another OTP code before + * the first one has expired, the first one will be invalidated. * * Exactly one of `intermediate_session_token`, `session_token`, or `session_jwt` must be provided in the request. * If an intermediate session token is provided, this operation will consume it. @@ -167,9 +172,11 @@ public interface Sms { * SMS OTPs may not be used as a primary authentication mechanism. They can be used to complete an MFA requirement, or * they can be used as a step-up factor to be added to an existing session. * - * This endpoint verifies that the one-time passcode (OTP) is valid and hasn't expired or been previously used. A given - * Member may only have a single active OTP code at any given time. If a Member requests another OTP code before the first - * one has expired, the first one will be invalidated. + * This endpoint verifies that the one-time passcode (OTP) is valid and hasn't expired or been previously used. OTP codes + * expire after two minutes. + * + * A given Member may only have a single active OTP code at any given time. If a Member requests another OTP code before + * the first one has expired, the first one will be invalidated. * * Exactly one of `intermediate_session_token`, `session_token`, or `session_jwt` must be provided in the request. * If an intermediate session token is provided, this operation will consume it. @@ -199,9 +206,11 @@ public interface Sms { * SMS OTPs may not be used as a primary authentication mechanism. They can be used to complete an MFA requirement, or * they can be used as a step-up factor to be added to an existing session. * - * This endpoint verifies that the one-time passcode (OTP) is valid and hasn't expired or been previously used. A given - * Member may only have a single active OTP code at any given time. If a Member requests another OTP code before the first - * one has expired, the first one will be invalidated. + * This endpoint verifies that the one-time passcode (OTP) is valid and hasn't expired or been previously used. OTP codes + * expire after two minutes. + * + * A given Member may only have a single active OTP code at any given time. If a Member requests another OTP code before + * the first one has expired, the first one will be invalidated. * * Exactly one of `intermediate_session_token`, `session_token`, or `session_jwt` must be provided in the request. * If an intermediate session token is provided, this operation will consume it. diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwords/Passwords.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwords/Passwords.kt index 8fb5a72..a2228ab 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwords/Passwords.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwords/Passwords.kt @@ -7,6 +7,8 @@ package com.stytch.java.b2b.api.passwords // !!! import com.squareup.moshi.Moshi +import com.stytch.java.b2b.api.passwordsdiscovery.Discovery +import com.stytch.java.b2b.api.passwordsdiscovery.DiscoveryImpl import com.stytch.java.b2b.api.passwordsemail.Email import com.stytch.java.b2b.api.passwordsemail.EmailImpl import com.stytch.java.b2b.api.passwordsexistingpassword.ExistingPassword @@ -37,6 +39,8 @@ public interface Passwords { public val existingPassword: ExistingPassword + public val discovery: Discovery + /** * This API allows you to check whether the user’s provided password is valid, and to provide feedback to the user on how * to increase the strength of their password. @@ -221,6 +225,7 @@ internal class PasswordsImpl( override val email: Email = EmailImpl(httpClient, coroutineScope) override val sessions: Sessions = SessionsImpl(httpClient, coroutineScope) override val existingPassword: ExistingPassword = ExistingPasswordImpl(httpClient, coroutineScope) + override val discovery: Discovery = DiscoveryImpl(httpClient, coroutineScope) override suspend fun strengthCheck(data: StrengthCheckRequest): StytchResult = withContext(Dispatchers.IO) { diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordsdiscovery/PasswordsDiscovery.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordsdiscovery/PasswordsDiscovery.kt new file mode 100644 index 0000000..b9d5e60 --- /dev/null +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordsdiscovery/PasswordsDiscovery.kt @@ -0,0 +1,67 @@ +package com.stytch.java.b2b.api.passwordsdiscovery + +// !!! +// WARNING: This file is autogenerated +// Only modify code within MANUAL() sections +// or your changes may be overwritten later! +// !!! + +import com.squareup.moshi.Moshi +import com.stytch.java.b2b.api.passwordsdiscoveryemail.Email +import com.stytch.java.b2b.api.passwordsdiscoveryemail.EmailImpl +import com.stytch.java.b2b.models.passwordsdiscovery.AuthenticateRequest +import com.stytch.java.b2b.models.passwordsdiscovery.AuthenticateResponse +import com.stytch.java.common.InstantAdapter +import com.stytch.java.common.StytchResult +import com.stytch.java.http.HttpClient +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.async +import kotlinx.coroutines.future.asCompletableFuture +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext +import java.util.concurrent.CompletableFuture + +public interface Discovery { + public val email: Email + + public suspend fun authenticate(data: AuthenticateRequest): StytchResult + + public fun authenticate( + data: AuthenticateRequest, + callback: (StytchResult) -> Unit, + ) + + public fun authenticateCompletable(data: AuthenticateRequest): CompletableFuture> +} + +internal class DiscoveryImpl( + private val httpClient: HttpClient, + private val coroutineScope: CoroutineScope, +) : Discovery { + private val moshi = Moshi.Builder().add(InstantAdapter()).build() + + override val email: Email = EmailImpl(httpClient, coroutineScope) + + override suspend fun authenticate(data: AuthenticateRequest): StytchResult = + withContext(Dispatchers.IO) { + var headers = emptyMap() + + val asJson = moshi.adapter(AuthenticateRequest::class.java).toJson(data) + httpClient.post("/v1/b2b/passwords/discovery/authenticate", asJson, headers) + } + + override fun authenticate( + data: AuthenticateRequest, + callback: (StytchResult) -> Unit, + ) { + coroutineScope.launch { + callback(authenticate(data)) + } + } + + override fun authenticateCompletable(data: AuthenticateRequest): CompletableFuture> = + coroutineScope.async { + authenticate(data) + }.asCompletableFuture() +} diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordsdiscoveryemail/PasswordsDiscoveryEmail.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordsdiscoveryemail/PasswordsDiscoveryEmail.kt new file mode 100644 index 0000000..8b4aae9 --- /dev/null +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordsdiscoveryemail/PasswordsDiscoveryEmail.kt @@ -0,0 +1,94 @@ +package com.stytch.java.b2b.api.passwordsdiscoveryemail + +// !!! +// WARNING: This file is autogenerated +// Only modify code within MANUAL() sections +// or your changes may be overwritten later! +// !!! + +import com.squareup.moshi.Moshi +import com.stytch.java.b2b.models.passwordsdiscoveryemail.ResetRequest +import com.stytch.java.b2b.models.passwordsdiscoveryemail.ResetResponse +import com.stytch.java.b2b.models.passwordsdiscoveryemail.ResetStartRequest +import com.stytch.java.b2b.models.passwordsdiscoveryemail.ResetStartResponse +import com.stytch.java.common.InstantAdapter +import com.stytch.java.common.StytchResult +import com.stytch.java.http.HttpClient +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.async +import kotlinx.coroutines.future.asCompletableFuture +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext +import java.util.concurrent.CompletableFuture + +public interface Email { + public suspend fun resetStart(data: ResetStartRequest): StytchResult + + public fun resetStart( + data: ResetStartRequest, + callback: (StytchResult) -> Unit, + ) + + public fun resetStartCompletable(data: ResetStartRequest): CompletableFuture> + + public suspend fun reset(data: ResetRequest): StytchResult + + public fun reset( + data: ResetRequest, + callback: (StytchResult) -> Unit, + ) + + public fun resetCompletable(data: ResetRequest): CompletableFuture> +} + +internal class EmailImpl( + private val httpClient: HttpClient, + private val coroutineScope: CoroutineScope, +) : Email { + private val moshi = Moshi.Builder().add(InstantAdapter()).build() + + override suspend fun resetStart(data: ResetStartRequest): StytchResult = + withContext(Dispatchers.IO) { + var headers = emptyMap() + + val asJson = moshi.adapter(ResetStartRequest::class.java).toJson(data) + httpClient.post("/v1/b2b/passwords/discovery/email/reset/start", asJson, headers) + } + + override fun resetStart( + data: ResetStartRequest, + callback: (StytchResult) -> Unit, + ) { + coroutineScope.launch { + callback(resetStart(data)) + } + } + + override fun resetStartCompletable(data: ResetStartRequest): CompletableFuture> = + coroutineScope.async { + resetStart(data) + }.asCompletableFuture() + + override suspend fun reset(data: ResetRequest): StytchResult = + withContext(Dispatchers.IO) { + var headers = emptyMap() + + val asJson = moshi.adapter(ResetRequest::class.java).toJson(data) + httpClient.post("/v1/b2b/passwords/discovery/email/reset", asJson, headers) + } + + override fun reset( + data: ResetRequest, + callback: (StytchResult) -> Unit, + ) { + coroutineScope.launch { + callback(reset(data)) + } + } + + override fun resetCompletable(data: ResetRequest): CompletableFuture> = + coroutineScope.async { + reset(data) + }.asCompletableFuture() +} diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordsemail/PasswordsEmail.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordsemail/PasswordsEmail.kt index 102153a..253b4ac 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordsemail/PasswordsEmail.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/api/passwordsemail/PasswordsEmail.kt @@ -7,8 +7,9 @@ package com.stytch.java.b2b.api.passwordsemail // !!! import com.squareup.moshi.Moshi -import com.stytch.java.b2b.models.passwordsemail.DeleteRequest -import com.stytch.java.b2b.models.passwordsemail.DeleteResponse +import com.stytch.java.b2b.models.passwordsemail.RequireResetRequest +import com.stytch.java.b2b.models.passwordsemail.RequireResetRequestOptions +import com.stytch.java.b2b.models.passwordsemail.RequireResetResponse import com.stytch.java.b2b.models.passwordsemail.ResetRequest import com.stytch.java.b2b.models.passwordsemail.ResetResponse import com.stytch.java.b2b.models.passwordsemail.ResetStartRequest @@ -139,14 +140,21 @@ public interface Email { */ public fun resetCompletable(data: ResetRequest): CompletableFuture> - public suspend fun delete(data: DeleteRequest): StytchResult + public suspend fun requireReset( + data: RequireResetRequest, + methodOptions: RequireResetRequestOptions? = null, + ): StytchResult - public fun delete( - data: DeleteRequest, - callback: (StytchResult) -> Unit, + public fun requireReset( + data: RequireResetRequest, + methodOptions: RequireResetRequestOptions? = null, + callback: (StytchResult) -> Unit, ) - public fun deleteCompletable(data: DeleteRequest): CompletableFuture> + public fun requireResetCompletable( + data: RequireResetRequest, + methodOptions: RequireResetRequestOptions? = null, + ): CompletableFuture> } internal class EmailImpl( @@ -199,25 +207,35 @@ internal class EmailImpl( reset(data) }.asCompletableFuture() - override suspend fun delete(data: DeleteRequest): StytchResult = + override suspend fun requireReset( + data: RequireResetRequest, + methodOptions: RequireResetRequestOptions?, + ): StytchResult = withContext(Dispatchers.IO) { var headers = emptyMap() + methodOptions?.let { + headers = methodOptions.addHeaders(headers) + } - val asJson = moshi.adapter(DeleteRequest::class.java).toJson(data) - httpClient.post("/v1/b2b/passwords/email/delete", asJson, headers) + val asJson = moshi.adapter(RequireResetRequest::class.java).toJson(data) + httpClient.post("/v1/b2b/passwords/email/require_reset", asJson, headers) } - override fun delete( - data: DeleteRequest, - callback: (StytchResult) -> Unit, + override fun requireReset( + data: RequireResetRequest, + methodOptions: RequireResetRequestOptions?, + callback: (StytchResult) -> Unit, ) { coroutineScope.launch { - callback(delete(data)) + callback(requireReset(data, methodOptions)) } } - override fun deleteCompletable(data: DeleteRequest): CompletableFuture> = + override fun requireResetCompletable( + data: RequireResetRequest, + methodOptions: RequireResetRequestOptions?, + ): CompletableFuture> = coroutineScope.async { - delete(data) + requireReset(data, methodOptions) }.asCompletableFuture() } diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/models/organizations/Organizations.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/models/organizations/Organizations.kt index c3bca85..6f70a14 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/models/organizations/Organizations.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/models/organizations/Organizations.kt @@ -383,18 +383,43 @@ public data class OAuthRegistration public data class OIDCProviderInfo @JvmOverloads constructor( + /** + * The unique identifier for the User within a given OAuth provider. Also commonly called the `sub` or "Subject field" in + * OAuth protocols. + */ @Json(name = "provider_subject") val providerSubject: String, + /** + * The `id_token` returned by the OAuth provider. ID Tokens are JWTs that contain structured information about a user. The + * exact content of each ID Token varies from provider to provider. ID Tokens are returned from OAuth providers that + * conform to the [OpenID Connect](https://openid.net/foundation/) specification, which is based on OAuth. + */ @Json(name = "id_token") val idToken: String, + /** + * The `access_token` that you may use to access the User's data in the provider's API. + */ @Json(name = "access_token") val accessToken: String, + /** + * The number of seconds until the access token expires. + */ @Json(name = "access_token_expires_in") val accessTokenExpiresIn: Int, + /** + * The OAuth scopes included for a given provider. See each provider's section above to see which scopes are included by + * default and how to add custom scopes. + */ @Json(name = "scopes") val scopes: List, + /** + * Globally unique UUID that identifies a specific SSO `connection_id` for a Member. + */ @Json(name = "connection_id") val connectionId: String, + /** + * The `refresh_token` that you may use to obtain a new `access_token` for the User within the provider's API. + */ @Json(name = "refresh_token") val refreshToken: String? = null, ) diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/models/organizationsmembers/OrganizationsMembers.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/models/organizationsmembers/OrganizationsMembers.kt index 833acef..6582d35 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/models/organizationsmembers/OrganizationsMembers.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/models/organizationsmembers/OrganizationsMembers.kt @@ -593,26 +593,55 @@ public data class GetResponse val statusCode: Int, ) +/** +* Request type for `Members.oidcProviders`. +*/ @JsonClass(generateAdapter = true) public data class OIDCProviderInformationRequest @JvmOverloads constructor( + /** + * 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. + */ @Json(name = "organization_id") val organizationId: String, + /** + * Globally unique UUID that identifies a specific Member. The `member_id` is critical to perform operations on a Member, + * so be sure to preserve this value. + */ @Json(name = "member_id") val memberId: String, + /** + * Whether to return the refresh token Stytch has stored for the OAuth Provider. Defaults to false. **Important:** If your + * application exchanges the refresh token, Stytch may not be able to automatically refresh access tokens in the future. + */ @Json(name = "include_refresh_token") val includeRefreshToken: Boolean? = null, ) +/** +* Response type for `Members.oidcProviders`. +*/ @JsonClass(generateAdapter = true) public data class OIDCProvidersResponse @JvmOverloads constructor( + /** + * 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. + */ @Json(name = "request_id") val requestId: String, + /** + * A list of tokens the member is registered with. + */ @Json(name = "registrations") val registrations: List, + /** + * 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. + */ @Json(name = "status_code") val statusCode: Int, ) diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/models/passwordsdiscovery/PasswordsDiscovery.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/models/passwordsdiscovery/PasswordsDiscovery.kt new file mode 100644 index 0000000..9524141 --- /dev/null +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/models/passwordsdiscovery/PasswordsDiscovery.kt @@ -0,0 +1,37 @@ +package com.stytch.java.b2b.models.passwordsdiscovery + +// !!! +// WARNING: This file is autogenerated +// Only modify code within MANUAL() sections +// or your changes may be overwritten later! +// !!! + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +import com.stytch.java.b2b.models.discovery.DiscoveredOrganization + +@JsonClass(generateAdapter = true) +public data class AuthenticateRequest + @JvmOverloads + constructor( + @Json(name = "email_address") + val emailAddress: String, + @Json(name = "password") + val password: String, + ) + +@JsonClass(generateAdapter = true) +public data class AuthenticateResponse + @JvmOverloads + constructor( + @Json(name = "request_id") + val requestId: String, + @Json(name = "email_address") + val emailAddress: String, + @Json(name = "intermediate_session_token") + val intermediateSessionToken: String, + @Json(name = "discovered_organizations") + val discoveredOrganizations: List, + @Json(name = "status_code") + val statusCode: Int, + ) diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/models/passwordsdiscoveryemail/PasswordsDiscoveryEmail.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/models/passwordsdiscoveryemail/PasswordsDiscoveryEmail.kt new file mode 100644 index 0000000..f877441 --- /dev/null +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/models/passwordsdiscoveryemail/PasswordsDiscoveryEmail.kt @@ -0,0 +1,71 @@ +package com.stytch.java.b2b.models.passwordsdiscoveryemail + +// !!! +// WARNING: This file is autogenerated +// Only modify code within MANUAL() sections +// or your changes may be overwritten later! +// !!! + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass +import com.stytch.java.b2b.models.discovery.DiscoveredOrganization + +@JsonClass(generateAdapter = true) +public data class ResetRequest + @JvmOverloads + constructor( + @Json(name = "password_reset_token") + val passwordResetToken: String, + @Json(name = "password") + val password: String, + @Json(name = "pkce_code_verifier") + val pkceCodeVerifier: String? = null, + @Json(name = "locale") + val locale: String? = null, + ) + +@JsonClass(generateAdapter = true) +public data class ResetResponse + @JvmOverloads + constructor( + @Json(name = "request_id") + val requestId: String, + @Json(name = "intermediate_session_token") + val intermediateSessionToken: String, + @Json(name = "email_address") + val emailAddress: String, + @Json(name = "discovered_organizations") + val discoveredOrganizations: List, + @Json(name = "status_code") + val statusCode: Int, + ) + +@JsonClass(generateAdapter = true) +public data class ResetStartRequest + @JvmOverloads + constructor( + @Json(name = "email_address") + val emailAddress: String, + @Json(name = "reset_password_redirect_url") + val resetPasswordRedirectURL: String? = null, + @Json(name = "discovery_redirect_url") + val discoveryRedirectURL: String? = null, + @Json(name = "reset_password_template_id") + val resetPasswordTemplateId: String? = null, + @Json(name = "reset_password_expiration_minutes") + val resetPasswordExpirationMinutes: Int? = null, + @Json(name = "pkce_code_challenge") + val pkceCodeChallenge: String? = null, + @Json(name = "locale") + val locale: String? = null, + ) + +@JsonClass(generateAdapter = true) +public data class ResetStartResponse + @JvmOverloads + constructor( + @Json(name = "request_id") + val requestId: String, + @Json(name = "status_code") + val statusCode: Int, + ) diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/models/passwordsemail/PasswordsEmail.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/models/passwordsemail/PasswordsEmail.kt index c9ece74..ac1f0dd 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/models/passwordsemail/PasswordsEmail.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/models/passwordsemail/PasswordsEmail.kt @@ -12,6 +12,7 @@ import com.stytch.java.b2b.models.mfa.MfaRequired import com.stytch.java.b2b.models.organizations.Member import com.stytch.java.b2b.models.organizations.Organization import com.stytch.java.b2b.models.sessions.MemberSession +import com.stytch.java.common.methodoptions.Authorization @JsonClass(generateAdapter = false) public enum class ResetRequestLocale { @@ -37,8 +38,27 @@ public enum class ResetStartRequestLocale { PTBR, } +public data class RequireResetRequestOptions + @JvmOverloads + constructor( + /** + * Optional authorization object. + * Pass in an active Stytch Member session token or session JWT and the request + * will be run using that member's permissions. + */ + val authorization: Authorization? = null, + ) { + internal fun addHeaders(headers: Map = emptyMap()): Map { + var res = mapOf() + if (authorization != null) { + res = authorization.addHeaders(res) + } + return res + headers + } + } + @JsonClass(generateAdapter = true) -public data class DeleteRequest +public data class RequireResetRequest @JvmOverloads constructor( @Json(name = "email_address") @@ -50,7 +70,7 @@ public data class DeleteRequest ) @JsonClass(generateAdapter = true) -public data class DeleteResponse +public data class RequireResetResponse @JvmOverloads constructor( @Json(name = "member") diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/models/ssoexternal/SSOExternal.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/models/ssoexternal/SSOExternal.kt index 81a6a1c..63b06e2 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/models/ssoexternal/SSOExternal.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/models/ssoexternal/SSOExternal.kt @@ -140,9 +140,9 @@ public data class UpdateConnectionRequest val displayName: String? = null, /** * All Members who log in with this External connection will implicitly receive the specified Roles. See the - * [RBAC guide](https://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. + * [RBAC guide](https://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. */ @Json(name = "external_connection_implicit_role_assignments") val externalConnectionImplicitRoleAssignments: List? = emptyList(), @@ -151,8 +151,8 @@ public data class UpdateConnectionRequest * 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 + * 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. diff --git a/stytch/src/main/kotlin/com/stytch/java/b2b/models/ssosaml/SSOSAML.kt b/stytch/src/main/kotlin/com/stytch/java/b2b/models/ssosaml/SSOSAML.kt index 9545085..82c9541 100644 --- a/stytch/src/main/kotlin/com/stytch/java/b2b/models/ssosaml/SSOSAML.kt +++ b/stytch/src/main/kotlin/com/stytch/java/b2b/models/ssosaml/SSOSAML.kt @@ -332,7 +332,7 @@ public data class UpdateConnectionRequest * that grant specific role assignments. For each group-Role pair, if a Member logs in with this SAML connection and * belongs to the specified SAML 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, you must add a "groups" key to your SAML connection's + * Before adding any group implicit role assignments, you must add a "groups" key to your SAML connection's * `attribute_mapping`. Make sure that your IdP is configured to correctly send the group information. */ @Json(name = "saml_group_implicit_role_assignments") diff --git a/stytch/src/main/kotlin/com/stytch/java/consumer/models/webauthn/WebAuthn.kt b/stytch/src/main/kotlin/com/stytch/java/consumer/models/webauthn/WebAuthn.kt index 2f0f1ab..463623d 100644 --- a/stytch/src/main/kotlin/com/stytch/java/consumer/models/webauthn/WebAuthn.kt +++ b/stytch/src/main/kotlin/com/stytch/java/consumer/models/webauthn/WebAuthn.kt @@ -315,6 +315,12 @@ public data class RegisterStartRequest */ @Json(name = "return_passkey_credential_options") val returnPasskeyCredentialOptions: Boolean? = null, + @Json(name = "override_id") + val overrideId: String? = null, + @Json(name = "override_name") + val overrideName: String? = null, + @Json(name = "override_display_name") + val overrideDisplayName: String? = null, ) /**