mirror of
https://gitlab.com/fabinfra/fabaccess/fabaccess-api.git
synced 2025-03-12 06:41:51 +01:00
Improve Rust code generation and add Upgrade tasks
This commit is contained in:
parent
229026db42
commit
cae56b0084
16
auth.capnp
16
auth.capnp
@ -9,6 +9,7 @@ using import "main.capnp".Session;
|
||||
struct AuthSupported {
|
||||
mechs @0 :List(Mechanism);
|
||||
cbtypes @1 :List(Text);
|
||||
upgrades @2 :List(Text);
|
||||
}
|
||||
|
||||
struct Mechanism {
|
||||
@ -17,7 +18,7 @@ struct Mechanism {
|
||||
# Additional Info for OpenID / OAUTH2
|
||||
}
|
||||
|
||||
struct Response {
|
||||
struct Response(Successful) {
|
||||
enum Reason {
|
||||
aborted @0;
|
||||
# This authentication exchange was aborted by either side.
|
||||
@ -91,7 +92,7 @@ struct Response {
|
||||
# The exchange was successful and a new session has been created for the authzid that
|
||||
# was established by the SASL exchange.
|
||||
|
||||
session @4 :Session;
|
||||
session @4 :Successful;
|
||||
# The session that was created. It grants access to all capabilities the connecting
|
||||
# party has permissions for.
|
||||
|
||||
@ -104,8 +105,9 @@ struct Response {
|
||||
# The current authentication exchange was successful, but the client needs to perform
|
||||
# a second round of authentication (e.g. 2FA) to continue.
|
||||
|
||||
nextMechanisms @6 :List(Mechanism);
|
||||
# List of mechanisms now available to the client.
|
||||
tasks @6 :List(Mechanism);
|
||||
# List of mechanisms now available to the client. Authentication by those MUST NOT
|
||||
# establish a new security layer or set a new authorization id.
|
||||
|
||||
additionalData @7 :Data;
|
||||
# SASL may send additional data with the continue result. This MAY be a NULL-ptr or a
|
||||
@ -115,8 +117,8 @@ struct Response {
|
||||
}
|
||||
}
|
||||
|
||||
interface Authentication {
|
||||
step @0 ( data :Data ) -> Response;
|
||||
interface Authentication(Successful) {
|
||||
step @0 ( data :Data ) -> Response(Successful);
|
||||
# Respond to a challenge with more data. A client MUST NOT call this after having received an
|
||||
# "successful" response.
|
||||
|
||||
@ -129,6 +131,6 @@ interface Authentication {
|
||||
# after sending this response. The server MAY after a short grace period terminate the stream
|
||||
# without sending a response if no call to `step` was received by the client.
|
||||
|
||||
nextAuthenticate @2 ( mechanism :Text, initialData :Data ) -> Response;
|
||||
nextTask @2 ( mechanism :Text, initialData :Data ) -> Response(Successful);
|
||||
# Call this after a continue was returned
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ interface Bootstrap
|
||||
mechanisms @3 () -> AuthSupported;
|
||||
# Get a list of Mechanisms this server allows in this context.
|
||||
|
||||
createSession @4 ( mechanism :Text ) -> ( authentication :Authentication );
|
||||
createSession @4 ( mechanism :Text, upgrade :Text ) -> ( authentication :Authentication(Session) );
|
||||
# Create a new session with the server that you wish to authenticate using `mechanism`. If the
|
||||
# mechanism is a client-first mechanism you can then immediately call Authentication::step with
|
||||
# initial data in a pipelined fashion. If the mechanism is server-first you must call
|
||||
|
@ -1,5 +1,8 @@
|
||||
@0x80d4a09e28022edb;
|
||||
|
||||
using Rust = import "../programming_language/rust.capnp";
|
||||
$Rust.parentModule("schema::traits");
|
||||
|
||||
using CSharp = import "../programming_language/csharp.capnp";
|
||||
$CSharp.namespace("FabAccessAPI.Schema");
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
@0xcdb148188bb77a8e;
|
||||
|
||||
using Rust = import "../programming_language/rust.capnp";
|
||||
$Rust.parentModule("schema::traits");
|
||||
|
||||
using CSharp = import "../programming_language/csharp.capnp";
|
||||
$CSharp.namespace("FabAccessAPI.Schema");
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
@0xccad643c8c6f6b25;
|
||||
|
||||
using Rust = import "../programming_language/rust.capnp";
|
||||
$Rust.parentModule("schema::traits");
|
||||
|
||||
using CSharp = import "../programming_language/csharp.capnp";
|
||||
$CSharp.namespace("FabAccessAPI.Schema");
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
@0x9fa2b43397f34e02;
|
||||
|
||||
using Rust = import "../programming_language/rust.capnp";
|
||||
$Rust.parentModule("schema::traits");
|
||||
|
||||
using CSharp = import "../programming_language/csharp.capnp";
|
||||
$CSharp.namespace("FabAccessAPI.Schema");
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
@0x82abdb5c1dcf399d;
|
||||
|
||||
using Rust = import "../programming_language/rust.capnp";
|
||||
$Rust.parentModule("schema::traits");
|
||||
|
||||
using CSharp = import "../programming_language/csharp.capnp";
|
||||
$CSharp.namespace("FabAccessAPI.Schema");
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
@0xbab3de8275be2271;
|
||||
|
||||
using Rust = import "../programming_language/rust.capnp";
|
||||
$Rust.parentModule("schema::traits");
|
||||
|
||||
using CSharp = import "../programming_language/csharp.capnp";
|
||||
$CSharp.namespace("FabAccessAPI.Schema");
|
||||
|
||||
|
12
utils.capnp
12
utils.capnp
@ -56,14 +56,10 @@ struct UUID {
|
||||
}
|
||||
|
||||
using OID = Data;
|
||||
# An OID is encoded as a sequence of varints. In this encoding the lower 7 bits of each octet
|
||||
# contain data bits while the MSB indicates if the *following* octet is still part of this edge. It
|
||||
# is the same encoding UTF-8 uses. To decode you simply collect octets until you find an octet <128
|
||||
# and then concat the data bits of all the octets you've accumulated, including the current one.
|
||||
# This gives you the value of one node. Continue until you've exhausted the available data. This is
|
||||
# a rather efficient encoding since almost all edges of the OID tree are smaller than 128 and thus
|
||||
# encode into one byte. X.208 does *not* limit the size of nodes! However, a reasonable size limit
|
||||
# is 128 bit per node, which is the size of the UUID nodes in the `2.25` subtree.
|
||||
# An OID is encoded as a sequence of varints, following ITU-T Rec. X.690 Section 8.19.
|
||||
# Consider that X.208 does *not* limit the size of arc identifiers! However, a
|
||||
# reasonable size limit is 128 bit per arc, which is the size of the UUID nodes
|
||||
# in the `2.25` subtree.
|
||||
|
||||
struct Map(Key, Value) {
|
||||
# Generic Key-Value-Map
|
||||
|
Loading…
x
Reference in New Issue
Block a user