232 lines
7.1 KiB
Protocol Buffer
232 lines
7.1 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package zitadel.oidc.v2beta;
|
|
|
|
import "zitadel/object/v2beta/object.proto";
|
|
import "zitadel/protoc_gen_zitadel/v2/options.proto";
|
|
import "zitadel/oidc/v2beta/authorization.proto";
|
|
import "google/api/annotations.proto";
|
|
import "google/api/field_behavior.proto";
|
|
import "protoc-gen-openapiv2/options/annotations.proto";
|
|
import "validate/validate.proto";
|
|
|
|
option go_package = "github.com/zitadel/zitadel/pkg/grpc/oidc/v2beta;oidc";
|
|
|
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
|
|
info: {
|
|
title: "OIDC Service";
|
|
version: "2.0-beta";
|
|
description: "Get OIDC Auth Request details and create callback URLs. This project is in beta state. It can AND will continue breaking until the services provide the same functionality as the current login.";
|
|
contact:{
|
|
name: "ZITADEL"
|
|
url: "https://zitadel.com"
|
|
email: "hi@zitadel.com"
|
|
}
|
|
license: {
|
|
name: "Apache 2.0",
|
|
url: "https://github.com/zitadel/zitadel/blob/main/LICENSING.md";
|
|
};
|
|
};
|
|
schemes: HTTPS;
|
|
schemes: HTTP;
|
|
|
|
consumes: "application/json";
|
|
consumes: "application/grpc";
|
|
|
|
produces: "application/json";
|
|
produces: "application/grpc";
|
|
|
|
consumes: "application/grpc-web+proto";
|
|
produces: "application/grpc-web+proto";
|
|
|
|
host: "$CUSTOM_DOMAIN";
|
|
base_path: "/";
|
|
|
|
external_docs: {
|
|
description: "Detailed information about ZITADEL",
|
|
url: "https://zitadel.com/docs"
|
|
}
|
|
security_definitions: {
|
|
security: {
|
|
key: "OAuth2";
|
|
value: {
|
|
type: TYPE_OAUTH2;
|
|
flow: FLOW_ACCESS_CODE;
|
|
authorization_url: "$CUSTOM_DOMAIN/oauth/v2/authorize";
|
|
token_url: "$CUSTOM_DOMAIN/oauth/v2/token";
|
|
scopes: {
|
|
scope: {
|
|
key: "openid";
|
|
value: "openid";
|
|
}
|
|
scope: {
|
|
key: "urn:zitadel:iam:org:project:id:zitadel:aud";
|
|
value: "urn:zitadel:iam:org:project:id:zitadel:aud";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
security: {
|
|
security_requirement: {
|
|
key: "OAuth2";
|
|
value: {
|
|
scope: "openid";
|
|
scope: "urn:zitadel:iam:org:project:id:zitadel:aud";
|
|
}
|
|
}
|
|
}
|
|
responses: {
|
|
key: "403";
|
|
value: {
|
|
description: "Returned when the user does not have permission to access the resource.";
|
|
schema: {
|
|
json_schema: {
|
|
ref: "#/definitions/rpcStatus";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
responses: {
|
|
key: "404";
|
|
value: {
|
|
description: "Returned when the resource does not exist.";
|
|
schema: {
|
|
json_schema: {
|
|
ref: "#/definitions/rpcStatus";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
// Deprecated: use oidc service v2 instead. This service will be removed in the next major version of ZITADEL.
|
|
service OIDCService {
|
|
// Get AuthRequest
|
|
//
|
|
// Deprecated: please move to the corresponding endpoint under oidc service v2. This endpoint will be removed with the next major version of ZITADEL.
|
|
//
|
|
// Get OIDC Auth Request details by ID, obtained from the redirect URL. Returns details that are parsed from the application's Auth Request.
|
|
rpc GetAuthRequest (GetAuthRequestRequest) returns (GetAuthRequestResponse) {
|
|
option (google.api.http) = {
|
|
get: "/v2beta/oidc/auth_requests/{auth_request_id}"
|
|
};
|
|
|
|
option (zitadel.protoc_gen_zitadel.v2.options) = {
|
|
auth_option: {
|
|
permission: "authenticated"
|
|
}
|
|
};
|
|
|
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
|
deprecated: true;
|
|
responses: {
|
|
key: "200"
|
|
value: {
|
|
description: "OK";
|
|
}
|
|
};
|
|
};
|
|
}
|
|
|
|
// Create Callback
|
|
//
|
|
// Deprecated: please move to the corresponding endpoint under oidc service v2. This endpoint will be removed with the next major version of ZITADEL.
|
|
//
|
|
// Finalize an Auth Request and get the callback URL for success or failure.
|
|
// The user must be redirected to the URL in order to inform the application about the success or failure.
|
|
// On success, the URL contains details for the application to obtain the tokens.
|
|
// This method can only be called once for an Auth request.
|
|
rpc CreateCallback (CreateCallbackRequest) returns (CreateCallbackResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v2beta/oidc/auth_requests/{auth_request_id}"
|
|
body: "*"
|
|
};
|
|
|
|
option (zitadel.protoc_gen_zitadel.v2.options) = {
|
|
auth_option: {
|
|
permission: "authenticated"
|
|
}
|
|
};
|
|
|
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
|
deprecated: true;
|
|
responses: {
|
|
key: "200"
|
|
value: {
|
|
description: "OK";
|
|
}
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
message GetAuthRequestRequest {
|
|
string auth_request_id = 1 [
|
|
(validate.rules).string = {min_len: 1, max_len: 200},
|
|
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
min_length: 1;
|
|
max_length: 200;
|
|
description: "ID of the Auth Request, as obtained from the redirect URL.";
|
|
example: "\"163840776835432705\"";
|
|
}
|
|
];
|
|
}
|
|
|
|
message GetAuthRequestResponse {
|
|
AuthRequest auth_request = 1;
|
|
}
|
|
|
|
message CreateCallbackRequest {
|
|
string auth_request_id = 1 [
|
|
(validate.rules).string = {min_len: 1, max_len: 200},
|
|
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
description: "Set this field when the authorization flow failed. It creates a callback URL to the application, with the error details set.";
|
|
ref: "https://openid.net/specs/openid-connect-core-1_0.html#AuthError";
|
|
}
|
|
];
|
|
|
|
oneof callback_kind {
|
|
option (validate.required) = true;
|
|
Session session = 2;
|
|
AuthorizationError error = 3 [
|
|
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
description: "Set this field when the authorization flow failed. It creates a callback URL to the application, with the error details set.";
|
|
ref: "https://openid.net/specs/openid-connect-core-1_0.html#AuthError";
|
|
}
|
|
];
|
|
}
|
|
}
|
|
|
|
message Session {
|
|
string session_id = 1 [
|
|
(validate.rules).string = {min_len: 1, max_len: 200},
|
|
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
min_length: 1;
|
|
max_length: 200;
|
|
description: "ID of the session, used to login the user. Connects the session to the Auth Request.";
|
|
example: "\"163840776835432705\"";
|
|
}
|
|
];
|
|
|
|
string session_token = 2 [
|
|
(validate.rules).string = {min_len: 1, max_len: 500},
|
|
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
min_length: 1;
|
|
max_length: 500;
|
|
description: "Token to verify the session is valid";
|
|
}
|
|
];
|
|
}
|
|
|
|
message CreateCallbackResponse {
|
|
zitadel.object.v2beta.Details details = 1;
|
|
string callback_url = 2 [
|
|
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
description: "Callback URL where the user should be redirected, using a \"302 FOUND\" status. Contains details for the application to obtain the tokens on success, or error details on failure. Note that this field must be treated as credentials, as the contained code can be used to obtain tokens on behalve of the user.";
|
|
example: "\"https://client.example.org/cb?code=SplxlOBeZQQYbYS6WxSbIA&state=af0ifjsldkj\""
|
|
}
|
|
];
|
|
}
|
|
|