mirror of
https://github.com/andwati/zitadel.git
synced 2026-12-02 08:58:52 +00:00
389 lines
11 KiB
Protocol Buffer
389 lines
11 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package zitadel.session.v2alpha;
|
|
|
|
|
|
import "zitadel/object/v2alpha/object.proto";
|
|
import "zitadel/protoc_gen_zitadel/v2/options.proto";
|
|
import "zitadel/session/v2alpha/challenge.proto";
|
|
import "zitadel/session/v2alpha/session.proto";
|
|
import "google/api/annotations.proto";
|
|
import "google/api/field_behavior.proto";
|
|
import "google/protobuf/struct.proto";
|
|
import "protoc-gen-openapiv2/options/annotations.proto";
|
|
import "validate/validate.proto";
|
|
|
|
option go_package = "github.com/zitadel/zitadel/pkg/grpc/session/v2alpha;session";
|
|
|
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
|
|
info: {
|
|
title: "Session Service";
|
|
version: "2.0-alpha";
|
|
description: "This API is intended to manage sessions in a ZITADEL instance. This project is in alpha 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: "[email protected]"
|
|
}
|
|
license: {
|
|
name: "Apache 2.0",
|
|
url: "https://github.com/zitadel/zitadel/blob/main/LICENSE";
|
|
};
|
|
};
|
|
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: "$ZITADEL_DOMAIN";
|
|
base_path: "/";
|
|
|
|
external_docs: {
|
|
description: "Detailed information about ZITADEL",
|
|
url: "https://zitadel.com/docs"
|
|
}
|
|
|
|
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";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
service SessionService {
|
|
|
|
// Search sessions
|
|
rpc ListSessions (ListSessionsRequest) returns (ListSessionsResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v2alpha/sessions/_search"
|
|
body: "*"
|
|
};
|
|
|
|
option (zitadel.protoc_gen_zitadel.v2.options) = {
|
|
auth_option: {
|
|
permission: "authenticated"
|
|
}
|
|
};
|
|
|
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
|
summary: "Search sessions";
|
|
description: "Search for sessions"
|
|
responses: {
|
|
key: "200"
|
|
value: {
|
|
description: "OK";
|
|
}
|
|
};
|
|
responses: {
|
|
key: "400";
|
|
value: {
|
|
description: "invalid list query";
|
|
schema: {
|
|
json_schema: {
|
|
ref: "#/definitions/rpcStatus";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|
|
|
|
// GetSession a session
|
|
rpc GetSession (GetSessionRequest) returns (GetSessionResponse) {
|
|
option (google.api.http) = {
|
|
get: "/v2alpha/sessions/{session_id}"
|
|
};
|
|
|
|
option (zitadel.protoc_gen_zitadel.v2.options) = {
|
|
auth_option: {
|
|
permission: "authenticated"
|
|
}
|
|
};
|
|
|
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
|
summary: "Get a session";
|
|
description: "Get a session and all its information like the time of the user or password verification"
|
|
responses: {
|
|
key: "200"
|
|
value: {
|
|
description: "OK";
|
|
}
|
|
};
|
|
};
|
|
}
|
|
|
|
// Create a new session
|
|
rpc CreateSession (CreateSessionRequest) returns (CreateSessionResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v2alpha/sessions"
|
|
body: "*"
|
|
};
|
|
|
|
option (zitadel.protoc_gen_zitadel.v2.options) = {
|
|
auth_option: {
|
|
permission: "authenticated"
|
|
}
|
|
http_response: {
|
|
success_code: 201
|
|
}
|
|
};
|
|
|
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
|
summary: "Create a new session";
|
|
description: "Create a new session. A token will be returned, which is required for further updates of the session."
|
|
responses: {
|
|
key: "200"
|
|
value: {
|
|
description: "OK";
|
|
}
|
|
};
|
|
};
|
|
}
|
|
|
|
// Update a session
|
|
rpc SetSession (SetSessionRequest) returns (SetSessionResponse) {
|
|
option (google.api.http) = {
|
|
patch: "/v2alpha/sessions/{session_id}"
|
|
body: "*"
|
|
};
|
|
|
|
option (zitadel.protoc_gen_zitadel.v2.options) = {
|
|
auth_option: {
|
|
permission: "authenticated"
|
|
}
|
|
};
|
|
|
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
|
summary: "Update an existing session";
|
|
description: "Update an existing session with new information."
|
|
responses: {
|
|
key: "200"
|
|
value: {
|
|
description: "OK";
|
|
}
|
|
};
|
|
};
|
|
}
|
|
|
|
// Terminate a session
|
|
rpc DeleteSession (DeleteSessionRequest) returns (DeleteSessionResponse) {
|
|
option (google.api.http) = {
|
|
delete: "/v2alpha/sessions/{session_id}"
|
|
body: "*"
|
|
};
|
|
|
|
option (zitadel.protoc_gen_zitadel.v2.options) = {
|
|
auth_option: {
|
|
permission: "authenticated"
|
|
}
|
|
};
|
|
|
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
|
summary: "Terminate an existing session";
|
|
description: "Terminate your own session or if granted any other session."
|
|
responses: {
|
|
key: "200"
|
|
value: {
|
|
description: "OK";
|
|
}
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
message ListSessionsRequest{
|
|
zitadel.object.v2alpha.ListQuery query = 1;
|
|
repeated SearchQuery queries = 2;
|
|
}
|
|
|
|
message ListSessionsResponse{
|
|
zitadel.object.v2alpha.ListDetails details = 1;
|
|
repeated Session sessions = 2;
|
|
}
|
|
|
|
message GetSessionRequest{
|
|
string session_id = 1;
|
|
optional string session_token = 2;
|
|
}
|
|
message GetSessionResponse{
|
|
Session session = 1;
|
|
}
|
|
|
|
message CreateSessionRequest{
|
|
Checks checks = 1 [
|
|
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
description: "\"Check for user and password. Successful checks will be stated as factors on the session.\"";
|
|
}
|
|
];
|
|
map<string, bytes> metadata = 2 [
|
|
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
description: "\"custom key value list to be stored on the session\"";
|
|
}
|
|
];
|
|
repeated ChallengeKind challenges = 3;
|
|
}
|
|
|
|
message CreateSessionResponse{
|
|
zitadel.object.v2alpha.Details details = 1;
|
|
string session_id = 2 [
|
|
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
description: "\"id of the session\"";
|
|
example: "\"d654e6ba-70a3-48ef-a95d-37c8d8a7901a\"";
|
|
}
|
|
];
|
|
string session_token = 3 [
|
|
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
description: "\"token of the session, which is required for further updates of the session or the request other resources\"";
|
|
}
|
|
];
|
|
Challenges challenges = 4;
|
|
}
|
|
|
|
message SetSessionRequest{
|
|
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 to update\"";
|
|
example: "\"d654e6ba-70a3-48ef-a95d-37c8d8a7901a\"";
|
|
}
|
|
];
|
|
string session_token = 2 [
|
|
(validate.rules).string = {min_len: 1, max_len: 200},
|
|
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
min_length: 1;
|
|
max_length: 200;
|
|
description: "\"token of the session, previously returned on the create / update request\"";
|
|
}
|
|
];
|
|
Checks checks = 3[
|
|
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
description: "\"Check for user and password. Successful checks will be stated as factors on the session.\"";
|
|
}
|
|
];
|
|
map<string, bytes> metadata = 4 [
|
|
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
description: "\"custom key value list to be stored on the session\"";
|
|
}
|
|
];
|
|
repeated ChallengeKind challenges = 5;
|
|
}
|
|
|
|
message SetSessionResponse{
|
|
zitadel.object.v2alpha.Details details = 1;
|
|
string session_token = 2 [
|
|
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
description: "\"token of the session, which is required for further updates of the session or the request other resources\"";
|
|
}
|
|
];
|
|
Challenges challenges = 3;
|
|
}
|
|
|
|
message DeleteSessionRequest{
|
|
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 to terminate\"";
|
|
example: "\"d654e6ba-70a3-48ef-a95d-37c8d8a7901a\"";
|
|
}
|
|
];
|
|
optional string session_token = 2 [
|
|
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
description: "\"token of the session, previously returned on the create / update request\"";
|
|
}
|
|
];
|
|
}
|
|
|
|
message DeleteSessionResponse{
|
|
zitadel.object.v2alpha.Details details = 1;
|
|
}
|
|
|
|
message Checks {
|
|
optional CheckUser user = 1 [
|
|
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
description: "\"checks the user and updates the session on success\"";
|
|
}
|
|
];
|
|
optional CheckPassword password = 2 [
|
|
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
description: "\"Checks the password and updates the session on success. Requires that the user is already checked, either in the previous or the same request.\"";
|
|
}
|
|
];
|
|
optional CheckPasskey passkey = 3 [
|
|
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
description: "\"Checks the public key credential issued by the passkey client. Requires that the user is already checked and a passkey challenge to be requested, in any previous request.\"";
|
|
}
|
|
];
|
|
}
|
|
|
|
message CheckUser {
|
|
oneof search {
|
|
string user_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;
|
|
example: "\"d654e6ba-70a3-48ef-a95d-37c8d8a7901a\"";
|
|
}
|
|
];
|
|
string login_name = 2 [
|
|
(validate.rules).string = {min_len: 1, max_len: 200},
|
|
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
min_length: 1;
|
|
max_length: 200;
|
|
example: "\"mini@mouse.com\"";
|
|
}
|
|
];
|
|
}
|
|
}
|
|
|
|
message CheckPassword {
|
|
string password = 1 [
|
|
(validate.rules).string = {min_len: 1, max_len: 200},
|
|
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
min_length: 1;
|
|
max_length: 200;
|
|
example: "\"V3ryS3cure!\"";
|
|
}
|
|
];
|
|
}
|
|
|
|
message CheckPasskey {
|
|
google.protobuf.Struct credential_assertion_data = 1 [
|
|
(validate.rules).message.required = true,
|
|
(google.api.field_behavior) = REQUIRED,
|
|
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
|
description: "JSON representation of public key credential issued by the passkey client";
|
|
min_length: 55;
|
|
max_length: 1048576; //1 MB
|
|
}
|
|
];
|
|
}
|