Skip to content

Commit

Permalink
invitationCode and should be invitationToken
Browse files Browse the repository at this point in the history
  • Loading branch information
mthadley committed Jul 11, 2024
1 parent 0f5e867 commit 2f1d15e
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ import com.workos.usermanagement.types.AuthenticationAdditionalOptions
/**
* Builder for options when authenticating with an authorization code.
*
* @param invitationCode The token of an invitation. The invitation should be in the pending state.
* @param invitationToken The token of an invitation. The invitation should be in the pending state.
* @param ipAddress The IP address of the request from the user who is attempting to authenticate.
* @param userAgent The user agent of the request from the user who is attempting to authenticate.
*/
class AuthenticationAdditionalOptionsBuilder(
private var invitationCode: String? = null,
private var invitationToken: String? = null,
private var ipAddress: String? = null,
private var userAgent: String? = null
) {
/**
* Invitation Code
*/
fun invitationCode(value: String) = apply { invitationCode = value }
fun invitationToken(value: String) = apply { invitationToken = value }

/**
* IP Address
Expand All @@ -34,7 +34,7 @@ class AuthenticationAdditionalOptionsBuilder(
*/
fun build(): AuthenticationAdditionalOptions {
return AuthenticationAdditionalOptions(
invitationCode = this.invitationCode,
invitationToken = this.invitationToken,
ipAddress = this.ipAddress,
userAgent = this.userAgent,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class AuthenticationWithCodeOptionsBuilder(
clientSecret = this.clientSecret,
grantType = "authorization_code",
code = this.code,
invitationCode = this.options?.invitationCode,
invitationToken = this.options?.invitationToken,
ipAddress = this.options?.ipAddress,
userAgent = this.options?.userAgent,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class AuthenticationWithEmailVerificationOptionsBuilder(
grantType = "urn:workos:oauth:grant-type:email-verification:code",
code = this.code,
pendingAuthenticationToken = this.pendingAuthenticationToken,
invitationCode = this.options?.invitationCode,
invitationToken = this.options?.invitationToken,
ipAddress = this.options?.ipAddress,
userAgent = this.options?.userAgent,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class AuthenticationWithMagicAuthOptionsBuilder(
grantType = "urn:workos:oauth:grant-type:magic-auth:code",
email = this.email,
code = this.code,
invitationCode = this.options?.invitationCode,
invitationToken = this.options?.invitationToken,
ipAddress = this.options?.ipAddress,
userAgent = this.options?.userAgent,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class AuthenticationWithOrganizationSelectionOptionsBuilder(
grantType = "urn:workos:oauth:grant-type:organization-selection",
organizationId = this.organizationId,
pendingAuthenticationToken = this.pendingAuthenticationToken,
invitationCode = this.options?.invitationCode,
invitationToken = this.options?.invitationToken,
ipAddress = this.options?.ipAddress,
userAgent = this.options?.userAgent,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class AuthenticationWithPasswordOptionsBuilder(
grantType = "password",
email = this.email,
password = this.password,
invitationCode = this.options?.invitationCode,
invitationToken = this.options?.invitationToken,
ipAddress = this.options?.ipAddress,
userAgent = this.options?.userAgent,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class AuthenticationWithRefreshTokenOptionsBuilder(
clientSecret = this.clientSecret,
grantType = "refresh_token",
refreshToken = this.refreshToken,
invitationCode = this.options?.invitationCode,
invitationToken = this.options?.invitationToken,
ipAddress = this.options?.ipAddress,
userAgent = this.options?.userAgent,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class AuthenticationWithTotpOptionsBuilder(
code = this.code,
authenticationChallengeId = this.authenticationChallengeId,
pendingAuthenticationToken = this.pendingAuthenticationToken,
invitationCode = this.options?.invitationCode,
invitationToken = this.options?.invitationToken,
ipAddress = this.options?.ipAddress,
userAgent = this.options?.userAgent,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ open class AuthenticationAdditionalOptions(
* a specific organization, attaching the token to a user's authenticate call
* automatically provisions their membership to the organization.
*/
@JsonProperty("invitation_code")
open val invitationCode: String? = null,
@JsonProperty("invitation_token")
open val invitationToken: String? = null,

/**
* The IP address of the request from the user who is attempting to authenticate.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ class AuthenticationWithCodeOptions @JvmOverloads constructor(
@JsonProperty("code")
val code: String,

@JsonProperty("invitation_code")
override val invitationCode: String? = null,
@JsonProperty("invitation_token")
override val invitationToken: String? = null,

@JsonProperty("ip_address")
override val ipAddress: String? = null,

@JsonProperty("user_agent")
override val userAgent: String? = null
) : AuthenticationAdditionalOptions(invitationCode, ipAddress, userAgent) {
) : AuthenticationAdditionalOptions(invitationToken, ipAddress, userAgent) {
init {
require(clientId.isNotBlank()) { "Client ID is required" }
require(clientSecret.isNotBlank()) { "Client Secret is required" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ class AuthenticationWithEmailVerificationOptions @JvmOverloads constructor(
@JsonProperty("pending_authentication_token")
val pendingAuthenticationToken: String,

@JsonProperty("invitation_code")
override val invitationCode: String? = null,
@JsonProperty("invitation_token")
override val invitationToken: String? = null,

@JsonProperty("ip_address")
override val ipAddress: String? = null,

@JsonProperty("user_agent")
override val userAgent: String? = null
) : AuthenticationAdditionalOptions(invitationCode, ipAddress, userAgent) {
) : AuthenticationAdditionalOptions(invitationToken, ipAddress, userAgent) {
init {
require(clientId.isNotBlank()) { "Client ID is required" }
require(clientSecret.isNotBlank()) { "Client Secret is required" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ class AuthenticationWithMagicAuthOptions @JvmOverloads constructor(
@JsonProperty("code")
val code: String,

@JsonProperty("invitation_code")
override val invitationCode: String? = null,
@JsonProperty("invitation_token")
override val invitationToken: String? = null,

@JsonProperty("ip_address")
override val ipAddress: String? = null,

@JsonProperty("user_agent")
override val userAgent: String? = null
) : AuthenticationAdditionalOptions(invitationCode, ipAddress, userAgent) {
) : AuthenticationAdditionalOptions(invitationToken, ipAddress, userAgent) {
init {
require(clientId.isNotBlank()) { "Client ID is required" }
require(clientSecret.isNotBlank()) { "Client Secret is required" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ class AuthenticationWithOrganizationSelectionOptions @JvmOverloads constructor(
@JsonProperty("pending_authentication_token")
val pendingAuthenticationToken: String,

@JsonProperty("invitation_code")
override val invitationCode: String? = null,
@JsonProperty("invitation_token")
override val invitationToken: String? = null,

@JsonProperty("ip_address")
override val ipAddress: String? = null,

@JsonProperty("user_agent")
override val userAgent: String? = null
) : AuthenticationAdditionalOptions(invitationCode, ipAddress, userAgent) {
) : AuthenticationAdditionalOptions(invitationToken, ipAddress, userAgent) {
init {
require(clientId.isNotBlank()) { "Client ID is required" }
require(clientSecret.isNotBlank()) { "Client Secret is required" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ class AuthenticationWithPasswordOptions @JvmOverloads constructor(
@JsonProperty("password")
val password: String,

@JsonProperty("invitation_code")
override val invitationCode: String? = null,
@JsonProperty("invitation_token")
override val invitationToken: String? = null,

@JsonProperty("ip_address")
override val ipAddress: String? = null,

@JsonProperty("user_agent")
override val userAgent: String? = null
) : AuthenticationAdditionalOptions(invitationCode, ipAddress, userAgent) {
) : AuthenticationAdditionalOptions(invitationToken, ipAddress, userAgent) {
init {
require(clientId.isNotBlank()) { "Client ID is required" }
require(clientSecret.isNotBlank()) { "Client Secret is required" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ class AuthenticationWithRefreshTokenOptions @JvmOverloads constructor(
@JsonProperty("refresh_token")
val refreshToken: String,

@JsonProperty("invitation_code")
override val invitationCode: String? = null,
@JsonProperty("invitation_token")
override val invitationToken: String? = null,

@JsonProperty("ip_address")
override val ipAddress: String? = null,

@JsonProperty("user_agent")
override val userAgent: String? = null
) : AuthenticationAdditionalOptions(invitationCode, ipAddress, userAgent) {
) : AuthenticationAdditionalOptions(invitationToken, ipAddress, userAgent) {
init {
require(clientId.isNotBlank()) { "Client ID is required" }
require(clientSecret.isNotBlank()) { "Client Secret is required" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ class AuthenticationWithTotpOptions @JvmOverloads constructor(
@JsonProperty("pending_authentication_token")
val pendingAuthenticationToken: String,

@JsonProperty("invitation_code")
override val invitationCode: String? = null,
@JsonProperty("invitation_token")
override val invitationToken: String? = null,

@JsonProperty("ip_address")
override val ipAddress: String? = null,

@JsonProperty("user_agent")
override val userAgent: String? = null
) : AuthenticationAdditionalOptions(invitationCode, ipAddress, userAgent) {
) : AuthenticationAdditionalOptions(invitationToken, ipAddress, userAgent) {
init {
require(clientId.isNotBlank()) { "Client ID is required" }
require(clientSecret.isNotBlank()) { "Client Secret is required" }
Expand Down

0 comments on commit 2f1d15e

Please sign in to comment.