Skip to content
Draft
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
23 changes: 12 additions & 11 deletions frontend/src/client/schemas.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6510,10 +6510,17 @@ export const $CustomOAuthProviderCreate = {
$ref: "#/components/schemas/OAuthGrantType",
},
authorization_endpoint: {
type: "string",
minLength: 8,
anyOf: [
{
type: "string",
},
{
type: "null",
},
],
title: "Authorization Endpoint",
description: "OAuth authorization endpoint URL",
description:
"OAuth authorization endpoint URL. Required for authorization_code grant type.",
},
token_endpoint: {
type: "string",
Expand Down Expand Up @@ -6574,13 +6581,7 @@ export const $CustomOAuthProviderCreate = {
},
},
type: "object",
required: [
"name",
"grant_type",
"authorization_endpoint",
"token_endpoint",
"client_id",
],
required: ["name", "grant_type", "token_endpoint", "client_id"],
title: "CustomOAuthProviderCreate",
description: "Request payload for creating a custom OAuth provider.",
} as const
Expand Down Expand Up @@ -9873,7 +9874,7 @@ export const $OAuth2AuthorizeResponse = {

export const $OAuthGrantType = {
type: "string",
enum: ["authorization_code", "client_credentials"],
enum: ["authorization_code", "client_credentials", "jwt_bearer"],
title: "OAuthGrantType",
description: "Grant type for OAuth 2.0.",
} as const
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/client/services.custom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export type CustomOAuthProviderCreateRequest = {
name: string
description?: string | null
grant_type: OAuthGrantType
authorization_endpoint: string
authorization_endpoint?: string | null
token_endpoint: string
scopes?: string[] | null
provider_id?: string | null
Expand Down
9 changes: 6 additions & 3 deletions frontend/src/client/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1941,9 +1941,9 @@ export type CustomOAuthProviderCreate = {
description?: string | null
grant_type: OAuthGrantType
/**
* OAuth authorization endpoint URL
* OAuth authorization endpoint URL. Required for authorization_code grant type.
*/
authorization_endpoint: string
authorization_endpoint?: string | null
/**
* OAuth token endpoint URL
*/
Expand Down Expand Up @@ -3177,7 +3177,10 @@ export type OAuth2AuthorizeResponse = {
/**
* Grant type for OAuth 2.0.
*/
export type OAuthGrantType = "authorization_code" | "client_credentials"
export type OAuthGrantType =
| "authorization_code"
| "client_credentials"
| "jwt_bearer"

/**
* Settings for OAuth authentication.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ const formSchema = z.object({
.max(512, { message: "Description must be 512 characters or fewer" })
.optional()
.or(z.literal("")),
grant_type: z.enum(["authorization_code", "client_credentials"]),
grant_type: z.enum([
"authorization_code",
"client_credentials",
"jwt_bearer",
]),
client_id: z
.string()
.trim()
Expand All @@ -68,7 +72,9 @@ const formSchema = z.object({
.url({ message: "Enter a valid HTTPS URL" })
.refine((value) => value.toLowerCase().startsWith("https://"), {
message: "Authorization endpoint must use HTTPS",
}),
})
.optional()
.or(z.literal("")),
token_endpoint: z
.string()
.trim()
Expand Down Expand Up @@ -103,6 +109,11 @@ const GRANT_OPTIONS = [
title: "Client credentials",
description: "Server-to-server access with tokens.",
},
{
value: "jwt_bearer" as const,
title: "Private key JWT",
description: "Service app with private key authentication.",
},
]

export function CreateCustomProviderDialog({
Expand Down Expand Up @@ -152,7 +163,8 @@ export function CreateCustomProviderDialog({
grant_type: values.grant_type,
client_id: values.client_id,
client_secret: values.client_secret?.trim() || undefined,
authorization_endpoint: values.authorization_endpoint,
authorization_endpoint:
values.authorization_endpoint?.trim() || undefined,
token_endpoint: values.token_endpoint,
scopes: values.scopes ?? [],
})
Expand Down Expand Up @@ -284,7 +296,9 @@ export function CreateCustomProviderDialog({
render={({ field }) => (
<FormItem>
<FormLabel>
Client secret{" "}
{grantType === "jwt_bearer"
? "Private key (PEM)"
: "Client secret"}{" "}
{grantType === "authorization_code" && (
<span className="text-xs text-muted-foreground">
(optional)
Expand All @@ -293,7 +307,11 @@ export function CreateCustomProviderDialog({
</FormLabel>
<FormControl>
<Input
placeholder="Client secret"
placeholder={
grantType === "jwt_bearer"
? "-----BEGIN RSA PRIVATE KEY-----"
: "Client secret"
}
type="password"
autoComplete="new-password"
{...field}
Expand All @@ -304,22 +322,24 @@ export function CreateCustomProviderDialog({
)}
/>
</div>
<FormField
control={form.control}
name="authorization_endpoint"
render={({ field }) => (
<FormItem>
<FormLabel>Authorization endpoint</FormLabel>
<FormControl>
<Input
placeholder="https://example.com/oauth2/authorize"
{...field}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
{grantType !== "jwt_bearer" && (
<FormField
control={form.control}
name="authorization_endpoint"
render={({ field }) => (
<FormItem>
<FormLabel>Authorization endpoint</FormLabel>
<FormControl>
<Input
placeholder="https://example.com/oauth2/authorize"
{...field}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
)}
<FormField
control={form.control}
name="token_endpoint"
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/lib/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4601,7 +4601,8 @@ export function useCreateCustomProvider(workspaceId: string) {
...params,
name: params.name.trim(),
description: params.description?.trim() || undefined,
authorization_endpoint: params.authorization_endpoint.trim(),
authorization_endpoint:
params.authorization_endpoint?.trim() || undefined,
token_endpoint: params.token_endpoint.trim(),
client_id: params.client_id.trim(),
client_secret: params.client_secret?.trim() || undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ definition:
secrets:
- name: okta
keys: ["OKTA_API_TOKEN"]
optional: true
- type: oauth
provider_id: okta
grant_type: jwt_bearer
optional: true
expects:
base_url:
type: str | None
Expand All @@ -28,7 +33,7 @@ definition:
method: POST
url: ${{ inputs.base_url || VARS.okta.base_url }}/api/v1/users/${{ FN.url_encode(inputs.user_id) }}/lifecycle/activate
headers:
Authorization: "SSWS ${{ SECRETS.okta.OKTA_API_TOKEN }}"
Authorization: "${{ \"Bearer \" + SECRETS.okta_oauth.OKTA_SERVICE_TOKEN || \"SSWS \" + SECRETS.okta.OKTA_API_TOKEN }}"
Accept: "application/json"
Content-Type: "application/json"
params:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ definition:
secrets:
- name: okta
keys: ["OKTA_API_TOKEN"]
optional: true
- type: oauth
provider_id: okta
grant_type: jwt_bearer
optional: true
expects:
base_url:
type: str | None
Expand All @@ -27,7 +32,7 @@ definition:
method: PUT
url: ${{ inputs.base_url || VARS.okta.base_url }}/api/v1/groups/${{ inputs.group_id }}/users/${{ FN.url_encode(inputs.user_id) }}
headers:
Authorization: "SSWS ${{ SECRETS.okta.OKTA_API_TOKEN }}"
Authorization: "${{ \"Bearer \" + SECRETS.okta_oauth.OKTA_SERVICE_TOKEN || \"SSWS \" + SECRETS.okta.OKTA_API_TOKEN }}"
Accept: "application/json"
Content-Type: "application/json"
returns: ${{ steps.add_user.result.data }}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ definition:
secrets:
- name: okta
keys: ["OKTA_API_TOKEN"]
optional: true
- type: oauth
provider_id: okta
grant_type: jwt_bearer
optional: true
expects:
base_url:
type: str | None
Expand Down Expand Up @@ -47,7 +52,7 @@ definition:
method: PUT
url: ${{ inputs.base_url || VARS.okta.base_url }}/api/v1/apps/${{ inputs.app_id }}/groups/${{ inputs.group_id }}
headers:
Authorization: "SSWS ${{ SECRETS.okta.OKTA_API_TOKEN }}"
Authorization: "${{ \"Bearer \" + SECRETS.okta_oauth.OKTA_SERVICE_TOKEN || \"SSWS \" + SECRETS.okta.OKTA_API_TOKEN }}"
Accept: "application/json"
Content-Type: "application/json"
payload: ${{ steps.add_priority.result }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ definition:
secrets:
- name: okta
keys: ["OKTA_API_TOKEN"]
optional: true
- type: oauth
provider_id: okta
grant_type: jwt_bearer
optional: true
expects:
base_url:
type: str | None
Expand All @@ -24,6 +29,6 @@ definition:
method: DELETE
url: ${{ inputs.base_url || VARS.okta.base_url }}/api/v1/users/${{ FN.url_encode(inputs.user_id) }}/sessions
headers:
Authorization: "SSWS ${{ SECRETS.okta.OKTA_API_TOKEN }}"
Authorization: "${{ \"Bearer \" + SECRETS.okta_oauth.OKTA_SERVICE_TOKEN || \"SSWS \" + SECRETS.okta.OKTA_API_TOKEN }}"
Accept: "application/json"
returns: ${{ steps.clear_sessions.result.data }}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ definition:
secrets:
- name: okta
keys: ["OKTA_API_TOKEN"]
optional: true
- type: oauth
provider_id: okta
grant_type: jwt_bearer
optional: true
expects:
base_url:
type: str | None
Expand Down Expand Up @@ -65,7 +70,7 @@ definition:
method: POST
url: ${{ inputs.base_url || VARS.okta.base_url }}/api/v1/users
headers:
Authorization: "SSWS ${{ SECRETS.okta.OKTA_API_TOKEN }}"
Authorization: "${{ \"Bearer \" + SECRETS.okta_oauth.OKTA_SERVICE_TOKEN || \"SSWS \" + SECRETS.okta.OKTA_API_TOKEN }}"
Accept: "application/json"
Content-Type: "application/json"
params:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ definition:
secrets:
- name: okta
keys: ["OKTA_API_TOKEN"]
optional: true
- type: oauth
provider_id: okta
grant_type: jwt_bearer
optional: true
expects:
user_id:
type: str
Expand All @@ -28,5 +33,5 @@ definition:
method: POST
url: ${{ inputs.base_url || VARS.okta.base_url }}/api/v1/users/${{ FN.url_encode(inputs.user_id) }}/lifecycle/expire_password?revokeSessions=${{ inputs.revoke_sessions }}
headers:
Authorization: "SSWS ${{ SECRETS.okta.OKTA_API_TOKEN }}"
Authorization: "${{ \"Bearer \" + SECRETS.okta_oauth.OKTA_SERVICE_TOKEN || \"SSWS \" + SECRETS.okta.OKTA_API_TOKEN }}"
returns: ${{ steps.expire_password.result.data }}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ definition:
secrets:
- name: okta
keys: ["OKTA_API_TOKEN"]
optional: true
- type: oauth
provider_id: okta
grant_type: jwt_bearer
optional: true
expects:
user_id:
type: str
Expand All @@ -28,5 +33,5 @@ definition:
method: POST
url: ${{ inputs.base_url || VARS.okta.base_url }}/api/v1/users/${{ FN.url_encode(inputs.user_id) }}/lifecycle/expire_password_with_temp_password?revokeSessions=${{ inputs.revoke_sessions }}
headers:
Authorization: "SSWS ${{ SECRETS.okta.OKTA_API_TOKEN }}"
Authorization: "${{ \"Bearer \" + SECRETS.okta_oauth.OKTA_SERVICE_TOKEN || \"SSWS \" + SECRETS.okta.OKTA_API_TOKEN }}"
returns: ${{ steps.expire_password_with_temp_password.result.data }}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ definition:
secrets:
- name: okta
keys: ["OKTA_API_TOKEN"]
optional: true
- type: oauth
provider_id: okta
grant_type: jwt_bearer
optional: true
expects:
base_url:
type: str | None
Expand Down Expand Up @@ -44,7 +49,7 @@ definition:
method: GET
url: ${{ inputs.base_url || VARS.okta.base_url }}/api/v1/groups/${{ inputs.group_id }}/users
headers:
Authorization: "SSWS ${{ SECRETS.okta.OKTA_API_TOKEN }}"
Authorization: "${{ \"Bearer \" + SECRETS.okta_oauth.OKTA_SERVICE_TOKEN || \"SSWS \" + SECRETS.okta.OKTA_API_TOKEN }}"
Accept: "application/json"
params: ${{ steps.build_params.result }}
returns: ${{ steps.get_members.result.data }}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ definition:
secrets:
- name: okta
keys: ["OKTA_API_TOKEN"]
optional: true
- type: oauth
provider_id: okta
grant_type: jwt_bearer
optional: true
expects:
base_url:
type: str | None
Expand Down Expand Up @@ -44,7 +49,7 @@ definition:
method: GET
url: ${{ inputs.base_url || VARS.okta.base_url }}/api/v1/users/${{ FN.url_encode(inputs.user_id) }}/groups
headers:
Authorization: "SSWS ${{ SECRETS.okta.OKTA_API_TOKEN }}"
Authorization: "${{ \"Bearer \" + SECRETS.okta_oauth.OKTA_SERVICE_TOKEN || \"SSWS \" + SECRETS.okta.OKTA_API_TOKEN }}"
Accept: "application/json"
params: ${{ steps.build_params.result }}
returns: ${{ steps.get_groups.result.data }}
Loading
Loading