feat: import upstream ZITADEL Login V2 v4.20.4 source workspace
This commit is contained in:
1 parent
eadd0e558b
commit
4404849fc4
644 files changed
+153201
-10
No files matched your search
@@ -0,0 +1,105 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package zitadel.session.v2;
|
||||
|
||||
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/v2;session";
|
||||
|
||||
enum UserVerificationRequirement {
|
||||
USER_VERIFICATION_REQUIREMENT_UNSPECIFIED = 0;
|
||||
USER_VERIFICATION_REQUIREMENT_REQUIRED = 1;
|
||||
USER_VERIFICATION_REQUIREMENT_PREFERRED = 2;
|
||||
USER_VERIFICATION_REQUIREMENT_DISCOURAGED = 3;
|
||||
}
|
||||
|
||||
message RequestChallenges {
|
||||
message WebAuthN {
|
||||
// The domain on which the session was created. Will be used in the WebAuthN challenge.
|
||||
// It must be either the exact domain or a top-level domain of the origin of the request.
|
||||
// For example if the request is coming from "login.example.com", the domain can be
|
||||
// "login.example.com" or "example.com", but not "other.com" or "sub.login.example.com".
|
||||
// See also: https://www.w3.org/TR/webauthn/#relying-party-identifier
|
||||
string domain = 1 [
|
||||
(validate.rules).string = {min_len: 1, max_len: 200},
|
||||
(google.api.field_behavior) = REQUIRED
|
||||
];
|
||||
|
||||
// User verification that is required during validation.
|
||||
// When set to `USER_VERIFICATION_REQUIREMENT_REQUIRED` the behaviour is for passkey authentication.
|
||||
// Other values will mean U2F.
|
||||
// See also: https://www.w3.org/TR/webauthn/#enum-userVerificationRequirement
|
||||
// If either the value is set to USER_VERIFICATION_REQUIREMENT_REQUIRED or the user verification
|
||||
// is passed as part of the authentication ceremony, the user_verified flag will be set in the resulting webauthn factor.
|
||||
UserVerificationRequirement user_verification_requirement = 2 [
|
||||
(validate.rules).enum = {
|
||||
defined_only: true,
|
||||
not_in: [0]
|
||||
},
|
||||
(google.api.field_behavior) = REQUIRED
|
||||
];
|
||||
}
|
||||
|
||||
message OTPSMS {
|
||||
// Request the code to be returned instead of sending an SMS.
|
||||
// This is useful for testing or in case you want to send the code yourself.
|
||||
bool return_code = 1;
|
||||
}
|
||||
|
||||
message OTPEmail {
|
||||
message SendCode {
|
||||
// Optionally set a url_template, which will be used in the mail sent by Zitadel to guide the user to your verification page.
|
||||
// If no template is set, the default Zitadel url will be used.
|
||||
//
|
||||
// The following placeholders can be used: Code, UserID, LoginName, DisplayName, PreferredLanguage, SessionID
|
||||
optional string url_template = 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: "\"https://example.com/otp/verify?userID={{.UserID}}&code={{.Code}}\"";
|
||||
}
|
||||
];
|
||||
}
|
||||
message ReturnCode {}
|
||||
|
||||
// if no delivery_type is specified, an email is sent with the default url
|
||||
oneof delivery_type {
|
||||
SendCode send_code = 2;
|
||||
ReturnCode return_code = 3;
|
||||
}
|
||||
}
|
||||
|
||||
// WebAuthN requests a challenge to be used in the WebAuthN authentication ceremony.
|
||||
// They can be used for both passkey and U2F authentication.
|
||||
// They're required for a webauthn check at the SetSession endpoint.
|
||||
optional WebAuthN web_auth_n = 1;
|
||||
|
||||
// OTPSMS requests a code to be sent via SMS to the user's primary phone.
|
||||
// It is required for an OTP check at the SetSession endpoint.
|
||||
optional OTPSMS otp_sms = 2;
|
||||
|
||||
// OTPEmail requests a code to be sent via email to the user's primary email address.
|
||||
// It is required for an OTP check at the SetSession endpoint.
|
||||
optional OTPEmail otp_email = 3;
|
||||
}
|
||||
|
||||
message Challenges {
|
||||
// WebAuthN contains the options for the Assertion Generation (dictionary PublicKeyCredentialRequestOptions).
|
||||
// Generated helper methods transform the field to JSON, for use in a WebauthN client.
|
||||
// See also: https://www.w3.org/TR/webauthn/#dictdef-publickeycredentialrequestoptions
|
||||
message WebAuthN {
|
||||
google.protobuf.Struct public_key_credential_request_options = 1 [
|
||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
||||
example: "{\"publicKey\":{\"allowCredentials\":[{\"id\":\"ATmqBg-99qyOZk2zloPdJQyS2R7IkFT7v9Hoos_B_nM\",\"type\":\"public-key\"}],\"challenge\":\"GAOHYz2jE69kJMYo6Laij8yWw9-dKKgbViNhfuy0StA\",\"rpId\":\"localhost\",\"timeout\":300000,\"userVerification\":\"required\"}}"
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
optional WebAuthN web_auth_n = 1;
|
||||
optional string otp_sms = 2;
|
||||
optional string otp_email = 3;
|
||||
}
|
||||
@@ -0,0 +1,222 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package zitadel.session.v2;
|
||||
|
||||
import "zitadel/object.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "protoc-gen-openapiv2/options/annotations.proto";
|
||||
import "validate/validate.proto";
|
||||
|
||||
option go_package = "github.com/zitadel/zitadel/pkg/grpc/session/v2;session";
|
||||
|
||||
message Session {
|
||||
// Unique identifier of the session.
|
||||
string id = 1;
|
||||
|
||||
// The timestamp the session was created.
|
||||
google.protobuf.Timestamp creation_date = 2;
|
||||
|
||||
// The timestamp the session was last updated.
|
||||
google.protobuf.Timestamp change_date = 3;
|
||||
|
||||
// The sequence of the session represents the change sequence of the session.
|
||||
uint64 sequence = 4;
|
||||
|
||||
// The factors that have been checked for this session, e.g. the user, password and more.
|
||||
// If a factor is set, it means it has been checked and is valid.
|
||||
// If a factor is not set, it means it has not been checked or is invalid.
|
||||
// If a factor is set, the verified_at timestamp indicates when it was last checked.
|
||||
Factors factors = 5;
|
||||
|
||||
// Metadata contains custom key value pairs set by the user.
|
||||
// The metadata is not interpreted by Zitadel and can be used to store any information
|
||||
// relevant to the session.
|
||||
map<string, bytes> metadata = 6;
|
||||
|
||||
// UserAgent contains information about the user agent used to create the session.
|
||||
// This can include information such as the IP address, browser type, and operating system and
|
||||
// a fingerprint id.
|
||||
// This can be used to identify and filter sessions based on the user agent.
|
||||
UserAgent user_agent = 7;
|
||||
|
||||
// ExpirationDate is the time the session will be automatically invalidated.
|
||||
// If not set, the session does not expire automatically.
|
||||
optional google.protobuf.Timestamp expiration_date = 8;
|
||||
}
|
||||
|
||||
message Factors {
|
||||
UserFactor user = 1;
|
||||
PasswordFactor password = 2;
|
||||
WebAuthNFactor web_auth_n = 3;
|
||||
IntentFactor intent = 4;
|
||||
TOTPFactor totp = 5;
|
||||
OTPFactor otp_sms = 6;
|
||||
OTPFactor otp_email = 7;
|
||||
RecoveryCodeFactor recovery_code = 8;
|
||||
}
|
||||
|
||||
message UserFactor {
|
||||
reserved 5;
|
||||
reserved "organisation_id";
|
||||
|
||||
// The timestamp when the user was last verified.
|
||||
google.protobuf.Timestamp verified_at = 1;
|
||||
|
||||
// The unique identifier of the user that was verified.
|
||||
string id = 2;
|
||||
|
||||
// The login name of the user that was verified.
|
||||
string login_name = 3;
|
||||
|
||||
// The display name of the user that was verified.
|
||||
string display_name = 4;
|
||||
|
||||
// The id of the organization the user belongs to.
|
||||
string organization_id = 6;
|
||||
}
|
||||
|
||||
message PasswordFactor {
|
||||
// The timestamp when the password was last verified.
|
||||
google.protobuf.Timestamp verified_at = 1;
|
||||
}
|
||||
|
||||
message IntentFactor {
|
||||
// The timestamp when the intent was last verified.
|
||||
google.protobuf.Timestamp verified_at = 1;
|
||||
}
|
||||
|
||||
message WebAuthNFactor {
|
||||
// The timestamp when the passkey challenge was last verified.
|
||||
google.protobuf.Timestamp verified_at = 1;
|
||||
|
||||
// Indicates if the user presence was verified during the last challenge.
|
||||
// This can be used to determine if the factor can be considered as multi-factor authentication.
|
||||
bool user_verified = 2;
|
||||
}
|
||||
|
||||
message TOTPFactor {
|
||||
// The timestamp when the TOTP was last verified.
|
||||
google.protobuf.Timestamp verified_at = 1;
|
||||
}
|
||||
|
||||
message OTPFactor {
|
||||
// The timestamp when the OTP was last verified either by SMS or Email.
|
||||
google.protobuf.Timestamp verified_at = 1;
|
||||
}
|
||||
|
||||
message RecoveryCodeFactor {
|
||||
// The timestamp when the Recovery Code was last verified.
|
||||
google.protobuf.Timestamp verified_at = 1;
|
||||
}
|
||||
|
||||
message SearchQuery {
|
||||
oneof query {
|
||||
option (validate.required) = true;
|
||||
|
||||
// Search for sessions with the given IDs.
|
||||
IDsQuery ids_query = 1;
|
||||
|
||||
// Search for sessions of the given user ID.
|
||||
UserIDQuery user_id_query = 2;
|
||||
|
||||
// Search for sessions based on their creation date.
|
||||
// This can be used to find sessions created before or after a certain date.
|
||||
CreationDateQuery creation_date_query = 3;
|
||||
|
||||
// Search for sessions created by a specific user.
|
||||
CreatorQuery creator_query = 4;
|
||||
|
||||
// Search for sessions based on the user agent used to create the session.
|
||||
// It can be used to find sessions created from a specific device or browser.
|
||||
// This is typically done for providing a list of active sessions to the user
|
||||
// in a user interface.
|
||||
UserAgentQuery user_agent_query = 5;
|
||||
|
||||
// Search for sessions based on their expiration date.
|
||||
// This can be used to find sessions that are set to expire before or after a certain date.
|
||||
ExpirationDateQuery expiration_date_query = 6;
|
||||
}
|
||||
}
|
||||
|
||||
message IDsQuery {
|
||||
// List of session IDs to search for.
|
||||
// If multiple IDs are provided, sessions matching any of the IDs will be returned.
|
||||
repeated string ids = 1;
|
||||
}
|
||||
|
||||
message UserIDQuery {
|
||||
// ID of the user whose sessions are being searched for.
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message CreationDateQuery {
|
||||
// The creation date to compare the session's creation date against.
|
||||
google.protobuf.Timestamp creation_date = 1;
|
||||
|
||||
// The method of comparison to use for the creation date.
|
||||
// This defines whether to search for sessions created before, after, or exactly at the specified date.
|
||||
zitadel.v1.TimestampQueryMethod method = 2 [
|
||||
(validate.rules).enum.defined_only = true
|
||||
];
|
||||
}
|
||||
|
||||
message CreatorQuery {
|
||||
// ID of the user who created the session. If empty, the calling user's ID is used.
|
||||
optional string id = 1 [
|
||||
(validate.rules).string = {max_len: 200},
|
||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
||||
max_length: 200;
|
||||
example: "\"69629023906488334\"";
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
message UserAgentQuery {
|
||||
// Finger print id of the user agent used for the session.
|
||||
// Set an empty fingerprint_id to use the user agent from the call.
|
||||
// If the user agent is not available from the current token, an error will be returned.
|
||||
optional string fingerprint_id = 1 [
|
||||
(validate.rules).string = {max_len: 200},
|
||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
||||
max_length: 200;
|
||||
example: "\"69629023906488334\"";
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
message ExpirationDateQuery {
|
||||
// The expiration date to compare the session's expiration date against.
|
||||
google.protobuf.Timestamp expiration_date = 1;
|
||||
|
||||
// The method of comparison to use for the expiration date.
|
||||
// This defines whether to search for sessions expiring before, after, or exactly at the specified date.
|
||||
zitadel.v1.TimestampQueryMethod method = 2 [
|
||||
(validate.rules).enum.defined_only = true
|
||||
];
|
||||
}
|
||||
|
||||
message UserAgent {
|
||||
// FingerprintID is a unique identifier for the user agent's fingerprint.
|
||||
// It can be used to group sessions by device or browser.
|
||||
optional string fingerprint_id = 1;
|
||||
|
||||
// IP is the IP address from which the session was created.
|
||||
optional string ip = 2;
|
||||
|
||||
// Description is a human-readable description of the user agent.
|
||||
optional string description = 3;
|
||||
|
||||
// A header may have multiple values.
|
||||
// In Go, headers are defined
|
||||
// as map[string][]string, but protobuf
|
||||
// doesn't allow this scheme.
|
||||
message HeaderValues {
|
||||
repeated string values = 1;
|
||||
}
|
||||
map<string, HeaderValues> header = 4;
|
||||
}
|
||||
|
||||
enum SessionFieldName {
|
||||
SESSION_FIELD_NAME_UNSPECIFIED = 0;
|
||||
SESSION_FIELD_NAME_CREATION_DATE = 1;
|
||||
}
|
||||
@@ -0,0 +1,665 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package zitadel.session.v2;
|
||||
|
||||
|
||||
import "zitadel/object/v2/object.proto";
|
||||
import "zitadel/protoc_gen_zitadel/v2/options.proto";
|
||||
import "zitadel/session/v2/challenge.proto";
|
||||
import "zitadel/session/v2/session.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/field_behavior.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
import "google/protobuf/duration.proto";
|
||||
import "protoc-gen-openapiv2/options/annotations.proto";
|
||||
import "validate/validate.proto";
|
||||
|
||||
option go_package = "github.com/zitadel/zitadel/pkg/grpc/session/v2;session";
|
||||
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
|
||||
info: {
|
||||
title: "Session Service";
|
||||
version: "2.0";
|
||||
description: "This API is intended to manage sessions in a Zitadel instance. Follow the guides on how to [build your own Login UI](/docs/guides/integrate/login-ui) and learn how to use the Session API.";
|
||||
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";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
service SessionService {
|
||||
|
||||
// List sessions
|
||||
//
|
||||
// Searches for sessions matching the given query. You can search by session ID, user ID,
|
||||
// creation date, creator, user agent or expiration date.
|
||||
//
|
||||
// Required permissions:
|
||||
// - `session.read`
|
||||
// - no permission required to search for own sessions
|
||||
rpc ListSessions (ListSessionsRequest) returns (ListSessionsResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2/sessions/search"
|
||||
body: "*"
|
||||
};
|
||||
|
||||
option (zitadel.protoc_gen_zitadel.v2.options) = {
|
||||
auth_option: {
|
||||
permission: "authenticated"
|
||||
}
|
||||
};
|
||||
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
responses: {
|
||||
key: "200"
|
||||
value: {
|
||||
description: "OK";
|
||||
}
|
||||
};
|
||||
responses: {
|
||||
key: "400";
|
||||
value: {
|
||||
description: "invalid list query";
|
||||
schema: {
|
||||
json_schema: {
|
||||
ref: "#/definitions/rpcStatus";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
// Get Session
|
||||
//
|
||||
// Retrieve a session by its ID. Returns all information about the session, including
|
||||
// the factors that were verified, the metadata, user agent information and possible expiration date.
|
||||
// The session token is required unless either of the following conditions is met:
|
||||
// - the caller created the session
|
||||
// - the authenticated user requests their own session (checked user)
|
||||
// - the security token provided in the authorization header has the same user agent as the session
|
||||
// - the caller is granted the permission session.read permission on either the instance or on the checked user's organization
|
||||
//
|
||||
// Required permissions:
|
||||
// - `session.read`
|
||||
// - no permission required to get own sessions (see above) or when providing the current session token
|
||||
rpc GetSession (GetSessionRequest) returns (GetSessionResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v2/sessions/{session_id}"
|
||||
};
|
||||
|
||||
option (zitadel.protoc_gen_zitadel.v2.options) = {
|
||||
auth_option: {
|
||||
permission: "authenticated"
|
||||
}
|
||||
};
|
||||
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
responses: {
|
||||
key: "200"
|
||||
value: {
|
||||
description: "OK";
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
// Create Session
|
||||
//
|
||||
// Create a new session with initial checks, metadata and challenges for further verification.
|
||||
// A token will be returned, which is required for using the session as authentication, e.g.
|
||||
// when authenticating an OIDC auth request or SAML request.
|
||||
// Additionally, the session token can be used as OAuth2 access token to authenticate against
|
||||
// the Zitadel APIs.
|
||||
//
|
||||
// Required permissions:
|
||||
// - `session.write`
|
||||
rpc CreateSession (CreateSessionRequest) returns (CreateSessionResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v2/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) = {
|
||||
responses: {
|
||||
key: "200"
|
||||
value: {
|
||||
description: "OK";
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
// Set Session
|
||||
//
|
||||
// Update an existing session with new information like additional checks or metadata
|
||||
// or request additional challenges.
|
||||
// A new session token will be returned. Note that the previous token will be invalidated.
|
||||
//
|
||||
// Required permissions:
|
||||
// - `session.write`
|
||||
rpc SetSession (SetSessionRequest) returns (SetSessionResponse) {
|
||||
option (google.api.http) = {
|
||||
patch: "/v2/sessions/{session_id}"
|
||||
body: "*"
|
||||
};
|
||||
|
||||
option (zitadel.protoc_gen_zitadel.v2.options) = {
|
||||
auth_option: {
|
||||
permission: "authenticated"
|
||||
}
|
||||
};
|
||||
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
responses: {
|
||||
key: "200"
|
||||
value: {
|
||||
description: "OK";
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
// DeleteSession
|
||||
//
|
||||
// Terminate an existing session. This invalidates the session and its token.
|
||||
// The session can no longer be used for the authentication of other resources
|
||||
// or to authenticate against the Zitadel APIs.
|
||||
//
|
||||
// You can only terminate your own session, unless you are granted the `session.delete` permission.
|
||||
//
|
||||
// Required permissions:
|
||||
// - `session.delete`
|
||||
// - no permission required for own sessions or when providing the current session token
|
||||
rpc DeleteSession (DeleteSessionRequest) returns (DeleteSessionResponse) {
|
||||
option (google.api.http) = {
|
||||
delete: "/v2/sessions/{session_id}"
|
||||
body: "*"
|
||||
};
|
||||
|
||||
option (zitadel.protoc_gen_zitadel.v2.options) = {
|
||||
auth_option: {
|
||||
permission: "authenticated"
|
||||
}
|
||||
};
|
||||
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
responses: {
|
||||
key: "200"
|
||||
value: {
|
||||
description: "OK";
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
message ListSessionsRequest{
|
||||
// List limitations and ordering.
|
||||
zitadel.object.v2.ListQuery query = 1;
|
||||
|
||||
// The criteria to be used when searching for sessions.
|
||||
// Multiple queries will be combined with a logical AND.
|
||||
repeated SearchQuery queries = 2;
|
||||
|
||||
// The column to be used for sorting the sessions.
|
||||
zitadel.session.v2.SessionFieldName sorting_column = 3;
|
||||
}
|
||||
|
||||
message ListSessionsResponse{
|
||||
// Contains details about the response, such as the total number of sessions.
|
||||
zitadel.object.v2.ListDetails details = 1;
|
||||
|
||||
// The sessions matching the search query. There might be more sessions available
|
||||
// than returned in this response. Use the details field to see if there are more sessions
|
||||
// available and to get the total count of sessions matching the query.
|
||||
repeated Session sessions = 2;
|
||||
}
|
||||
|
||||
message GetSessionRequest{
|
||||
// The unique identifier of the session to be retrieved.
|
||||
string session_id = 1 [
|
||||
(validate.rules).string = {min_len: 1, max_len: 200},
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
||||
min_length: 1;
|
||||
max_length: 200;
|
||||
example: "\"222430354126975533\"";
|
||||
}
|
||||
];
|
||||
|
||||
// The current token of the session, previously returned on the create / update request.
|
||||
// The token is required unless either of the following conditions is met:
|
||||
// - the caller created the session
|
||||
// - the authenticated user requests their own session (checked user)
|
||||
// - the security token provided in the authorization header has the same user agent as the session
|
||||
// - the caller is granted the permission session.read permission on either the instance or on the checked user's organization
|
||||
optional 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;
|
||||
example: "\"222430354126975533\"";
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
message GetSessionResponse{
|
||||
Session session = 1;
|
||||
}
|
||||
|
||||
message CreateSessionRequest{
|
||||
// The checks to be performed during session creation.
|
||||
// Note that a user check can only be performed once per session and cannot be changed afterwards.
|
||||
// Some checks require that the user is already checked, either in the previous or the same
|
||||
// request. For example, a password check requires that the user is already checked.
|
||||
// Other checks, like WebAuthN or IDP intent, require that the user is already checked and a challenge
|
||||
// was requested in any previous request.
|
||||
// On successful checks, the session's `factors` field will be updated.
|
||||
Checks checks = 1;
|
||||
|
||||
// Custom key value list to be stored on the session.
|
||||
map<string, bytes> metadata = 2;
|
||||
|
||||
// Challenges to be requested for further verification.
|
||||
// The challenges will be created and returned in the response.
|
||||
// The challenges can then be used for further checks with the following SetSession method.
|
||||
RequestChallenges challenges = 3;
|
||||
|
||||
// Store information about the user agent of the client.
|
||||
// This information is stored on the session and can be used for auditing or security purposes.
|
||||
// Sessions can also be filtered by user agent information.
|
||||
UserAgent user_agent = 4;
|
||||
|
||||
// Duration after which the session will be automatically invalidated.
|
||||
// If not set, the session will not expire automatically and must be deleted manually.
|
||||
// Note that an expired session cannot be used for authentication anymore, but will still be listed
|
||||
// until it is deleted.
|
||||
optional google.protobuf.Duration lifetime = 5 [
|
||||
(validate.rules).duration = {gt: {seconds: 0}},
|
||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
||||
example:"\"18000s\""
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
message CreateSessionResponse{
|
||||
zitadel.object.v2.Details details = 1;
|
||||
|
||||
// Unique identifier of the session.
|
||||
string session_id = 2 [
|
||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
||||
example: "\"222430354126975533\"";
|
||||
}
|
||||
];
|
||||
|
||||
// The current token of the session, which is required for using the session as authentication,
|
||||
// e.g.when authenticating an OIDC auth request or SAML request.
|
||||
// Additionally, the session token can be used as OAuth2 access token to authenticate against
|
||||
// the Zitadel APIs.
|
||||
string session_token = 3;
|
||||
|
||||
// The challenges that were requested for the session.
|
||||
// The challenges can be used for further checks with the SetSession method.
|
||||
Challenges challenges = 4;
|
||||
}
|
||||
|
||||
message SetSessionRequest{
|
||||
// The unique identifier of the session to be updated.
|
||||
string session_id = 1 [
|
||||
(validate.rules).string = {min_len: 1, max_len: 200},
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
||||
min_length: 1;
|
||||
max_length: 200;
|
||||
example: "\"222430354126975533\"";
|
||||
}
|
||||
];
|
||||
|
||||
// Deprecated: the session token is no longer required when updating a session
|
||||
// and will be ignored when provided.
|
||||
string session_token = 2 [
|
||||
deprecated=true
|
||||
];
|
||||
|
||||
// Additional checks to be performed on the session.
|
||||
// Successful checks will be stated as factors on the session.
|
||||
// Re-executing a check that was already successful will overwrite the previous check time.
|
||||
// For example, if a password check was already successful, it can be re-checked to update the check time.
|
||||
// Note that a user check can only be performed once per session and cannot be changed afterwards.
|
||||
// Some checks require that the user is already checked, either in the previous or the same request.
|
||||
// For example, a password check requires that the user is already checked.
|
||||
// Other checks, like WebAuthN or IDP intent, require that the user is already checked and a challenge
|
||||
// was requested in any previous request.
|
||||
// On successful checks, the session's `factors` field will be updated.
|
||||
Checks checks = 3;
|
||||
|
||||
// Additional custom key value pairs to be stored on the session.
|
||||
// Existing keys will be overwritten. To delete a key, set its value to an empty byte array.
|
||||
// Note that metadata keys cannot be changed once the session has been created.
|
||||
// You need to create a new entry and delete the old one instead.
|
||||
map<string, bytes> metadata = 4;
|
||||
|
||||
// Additional challenges to be requested for further verification.
|
||||
// The challenges will be created and returned in the response.
|
||||
// The challenges can then be used for further checks with the following SetSession method.
|
||||
// Requesting a challenge that was already requested will overwrite the previous challenge.
|
||||
RequestChallenges challenges = 5;
|
||||
|
||||
// Update the duration after which the session will be automatically invalidated.
|
||||
// If not set, the lifetime will not be changed.
|
||||
// Note that an expired session cannot be used for authentication anymore, but will still be listed
|
||||
// until it is deleted.
|
||||
optional google.protobuf.Duration lifetime = 6 [
|
||||
(validate.rules).duration = {gt: {seconds: 0}},
|
||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
||||
example:"\"18000s\""
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
message SetSessionResponse{
|
||||
zitadel.object.v2.Details details = 1;
|
||||
|
||||
// The current token of the session, which is required for using the session as authentication,
|
||||
// e.g.when authenticating an OIDC auth request or SAML request.
|
||||
// Additionally, the session token can be used as OAuth2 access token to authenticate against
|
||||
// the Zitadel APIs.
|
||||
// The previous token was invalidated and can no longer be used.
|
||||
string session_token = 2;
|
||||
|
||||
// The challenges that were requested for the session.
|
||||
// The challenges can be used for further checks with the SetSession method.
|
||||
Challenges challenges = 3;
|
||||
}
|
||||
|
||||
message DeleteSessionRequest{
|
||||
// The unique identifier of the session to be terminated.
|
||||
string session_id = 1 [
|
||||
(validate.rules).string = {min_len: 1, max_len: 200},
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
||||
min_length: 1;
|
||||
max_length: 200;
|
||||
example: "\"222430354126975533\"";
|
||||
}
|
||||
];
|
||||
|
||||
// The current token of the session, previously returned on the create / update request.
|
||||
// The token is required unless either of the following conditions is met:
|
||||
// - the caller created the session
|
||||
// - the authenticated user requests their own session (checked user)
|
||||
// - the security token provided in the authorization header has the same user agent as the session
|
||||
// - the caller is granted the permission session.delete permission on either the instance or on the checked user's organization
|
||||
optional string session_token = 2;
|
||||
}
|
||||
|
||||
message DeleteSessionResponse{
|
||||
zitadel.object.v2.Details details = 1;
|
||||
}
|
||||
|
||||
message Checks {
|
||||
// Check the user by its user ID or login name.
|
||||
// A user check can only be performed once per session and cannot be changed afterwards.
|
||||
// On successful user check, the session's `factors` field will be updated with a `user` factor
|
||||
// containing the checked user's ID, login name, display name, organization ID and verification time.
|
||||
// Note that some other checks require that the user is already checked, either in the previous
|
||||
// or the same request. For example, a password check requires that the user is already checked.
|
||||
optional CheckUser user = 1;
|
||||
|
||||
// Check the password and update the session on success.
|
||||
// Requires that the user is already checked, either in the previous or the same request.
|
||||
// On successful password check, the session's `factors` field will be updated with a `password` factor,
|
||||
// containing the verification time.
|
||||
// On failed password check id: "COMMAND-3M0fs" wll be returned.
|
||||
// On user locked out id: "COMMAND-JLK35"/"COMMAND-SFA3t" will be returned.
|
||||
optional CheckPassword password = 2;
|
||||
|
||||
// Check the public key credential issued by the WebAuthN client.
|
||||
// Requires that the user is already checked and a WebAuthN challenge to be requested,
|
||||
// in any previous request.
|
||||
// On successful WebAuthN check, the session's `factors` field will be updated with a `webauthn` factor,
|
||||
// containing the verification time and if the user presence was verified.
|
||||
optional CheckWebAuthN web_auth_n = 3;
|
||||
|
||||
// Check the IDP intent and update the session on success.
|
||||
// Requires that the user is already checked and an IDP intent succeeded and has not expired yet.
|
||||
// Note that the IDP intent must be either matching the same user as checked in the session,
|
||||
// or there must not be an external IDP linked to the intent's user.
|
||||
// On successful IDP intent check, the session's `factors` field will be updated with an `intent` factor,
|
||||
// containing the verification time.
|
||||
optional CheckIDPIntent idp_intent = 4;
|
||||
|
||||
// Check the TOTP and update the session on success.
|
||||
// Requires that the user is already checked, either in the previous or the same request.
|
||||
// On successful TOTP check, the session's `factors` field will be updated with a `totp` factor,
|
||||
// containing the verification time.
|
||||
optional CheckTOTP totp = 5;
|
||||
|
||||
// Check the OTP sent over SMS and update the session on success.
|
||||
// Requires that the user is already checked, either in the previous or the same request.
|
||||
// On successful OTP SMS check, the session's `factors` field will be updated with an `otp` factor,
|
||||
// containing the verification time.
|
||||
// Note that the OTP code is valid for a single use only and will be invalidated after a successful check.
|
||||
optional CheckOTP otp_sms = 6;
|
||||
|
||||
// Check the OTP sent over Email and update the session on success.
|
||||
// Requires that the user is already checked, either in the previous or the same request.
|
||||
// On successful OTP Email check, the session's `factors` field will be updated with an `otp` factor,
|
||||
// containing the verification time.
|
||||
// Note that the OTP code is valid for a single use only and will be invalidated after a successful check.
|
||||
optional CheckOTP otp_email = 7;
|
||||
|
||||
// Check the Recovery Code and update the session on success.
|
||||
// Requires that the user is already checked, either in the previous or the same request.
|
||||
// On successful Recovery Code check, the session's `factors` field will be updated with a `recovery_code` factor,
|
||||
// containing the verification time.
|
||||
optional CheckRecoveryCode recovery_code = 8;
|
||||
}
|
||||
|
||||
message CheckUser {
|
||||
// Search the user either by its user ID or login name.
|
||||
oneof search {
|
||||
option (validate.required) = true;
|
||||
|
||||
// The unique identifier of the user to be checked.
|
||||
string user_id = 1 [
|
||||
(validate.rules).string = {min_len: 1, max_len: 200},
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
||||
min_length: 1;
|
||||
max_length: 200;
|
||||
example: "\"d654e6ba-70a3-48ef-a95d-37c8d8a7901a\"";
|
||||
}
|
||||
];
|
||||
|
||||
// The login name of the user to be checked. It will search case insensitive.
|
||||
// Note this only checks for the computed login name and not for any organization scoped usernames.
|
||||
// Also note that it will not check for emails or phone numbers, even if the corresponding
|
||||
// setting is enabled. Use the user service ListUsers method to find a user by email or phone number first
|
||||
// to obtain the user ID or login name.
|
||||
string login_name = 2 [
|
||||
(validate.rules).string = {min_len: 1, max_len: 200},
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
||||
min_length: 1;
|
||||
max_length: 200;
|
||||
example: "\"mini@mouse.com\"";
|
||||
}
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
message CheckPassword {
|
||||
// The password of the user to be checked.
|
||||
string password = 1 [
|
||||
(validate.rules).string = {min_len: 1, max_len: 200},
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
||||
min_length: 1;
|
||||
max_length: 200;
|
||||
example: "\"V3ryS3cure!\"";
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
message CheckWebAuthN {
|
||||
// The JSON representation of the public key credential issued by the WebAuthN client.
|
||||
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) = {
|
||||
min_length: 55;
|
||||
max_length: 1048576; //1 MB
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
message CheckIDPIntent {
|
||||
// The ID of the idp intent, previously returned on the success response of the IDP callback.
|
||||
string idp_intent_id = 1 [
|
||||
(validate.rules).string = {min_len: 1, max_len: 200},
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
||||
min_length: 1;
|
||||
max_length: 200;
|
||||
example: "\"d654e6ba-70a3-48ef-a95d-37c8d8a7901a\"";
|
||||
}
|
||||
];
|
||||
|
||||
// The token of the idp intent, previously returned on the success response of the IDP callback.
|
||||
string idp_intent_token = 2 [
|
||||
(validate.rules).string = {min_len: 1, max_len: 500},
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
||||
min_length: 1;
|
||||
max_length: 500;
|
||||
example: "\"SJKL3ioIDpo342ioqw98fjp3sdf32wahb=\"";
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
message CheckTOTP {
|
||||
// The TOTP generated by the user's TOTP authenticator app.
|
||||
string code = 1 [
|
||||
(validate.rules).string = {min_len: 6, max_len: 6},
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
||||
min_length: 6;
|
||||
max_length: 6;
|
||||
example: "\"323764\"";
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
message CheckOTP {
|
||||
// The OTP sent over SMS or Email of the user to be checked.
|
||||
string code = 1 [
|
||||
(validate.rules).string = {min_len: 1},
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
|
||||
min_length: 1;
|
||||
example: "\"3237642\"";
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
message CheckRecoveryCode {
|
||||
// The Recovery Code of the user to be checked.
|
||||
// The code must match the exact code previously generated for the user, including dashes if any.
|
||||
// On successful check, the recovery code will be invalidated and cannot be used again.
|
||||
string code = 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: "\"1234567890\"";
|
||||
}
|
||||
];
|
||||
}
|
||||
Reference in new issue
Block a user