Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SetContext on Builder interface and GetContext on Biscuit struct. #153

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Benoit12345
Copy link

To be able to set a context and retrieve it form a biscuit.

@seh
Copy link
Contributor

seh commented Dec 5, 2024

What is a "context" in this context?

@Benoit12345
Copy link
Author

Benoit12345 commented Dec 6, 2024

"context" is the second field of the block liked it is indicated into the spec:

message Block {
  repeated string symbols = 1;
  optional string context = 2;
  optional uint32 version = 3;
  repeated FactV2 facts_v2 = 4;
  repeated RuleV2 rules_v2 = 5;
  repeated CheckV2 checks_v2 = 6;
  repeated Scope scope = 7;
  repeated PublicKey publicKeys = 8;
}

And the goal is to be able to be equivalent to the java biscuit library (https://github.com/biscuit-auth/biscuit-java/blob/a863cd8c0bd45ad1e36390ce777741e49417da0e/src/main/java/org/biscuitsec/biscuit/token/builder/Biscuit.java#L119)

if you're question is "are you talking about a Go std context ?", the answer is no but the context from biscuit specification.

@seh
Copy link
Contributor

seh commented Dec 6, 2024

"context" is the second field of the block liked it is indicated into the spec:

I did see that field in the IDL before asking the question here, but I'm wondering what a typical value would be for such a "context", who sets it, who consumes it, and why.

@divarvel
Copy link
Contributor

divarvel commented Dec 6, 2024

"context" is the second field of the block liked it is indicated into the spec:

I did see that field in the IDL before asking the question here, but I'm wondering what a typical value would be for such a "context", who sets it, who consumes it, and why.

It is intended as a way to embed a payload outside datalog. so something freeform that would not be directly used in the authorization context. It’s a remnant of early biscuit days, meant as some kind of escape hatch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants