-
Notifications
You must be signed in to change notification settings - Fork 22
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
Should the function generateWorld be accessible ? #147
Comments
I think it need to be ! Today, ther's no way to compare 2 biscuits or just read any facts... |
Any update on this subject ? The solution suggested by @Benoit12345 is exactly what I thought. Do you agree ? |
could you tell me more about the use case here? The |
Thanks @Geal, |
Thank you @Geal for your answer To add more information to @Benoit12345 comment about our use cases : We have different kinds of biscuit. Each kind allowing access to different kind of resources. So we can not use the In my tests : Query before authorizing b, err := biscuit.Unmarshal(token)
if err != nil {
panic("unmarhsal failed: " + err.Error())
}
fmt.Println(b.String())
authorizer, err := b.Authorizer(pub)
if err != nil {
panic("authorizer creation failed: " + err.Error())
}
authorizerRules, err := parser.FromStringRule(`
my::type($t) <- type($t)
`)
if err != nil {
panic("authorizer contents can not be parsed: " + err.Error())
}
authorizer.AddRule(authorizerRules)
fs, _ := authorizer.Query(authorizerRules) // fs = [] here Query after authorizing b, err := biscuit.Unmarshal(token)
if err != nil {
panic("unmarhsal failed: " + err.Error())
}
fmt.Println(b.String())
authorizer, err := b.Authorizer(pub)
if err != nil {
panic("authorizer creation failed: " + err.Error())
}
policy, err := parser.FromStringPolicy("allow if type(\"A\")")
if err != nil {
panic("unparsable policy: " + err.Error())
}
authorizer.AddPolicy(policy)
if err := authorizer.Authorize(); err != nil {
panic("failed authorizing: " + err.Error())
}
authorizerRules, err := parser.FromStringRule(`
my::type($t) <- type($t)
`)
if err != nil {
panic("authorizer contents can not be parsed: " + err.Error())
}
authorizer.AddRule(authorizerRules)
fs, _ := authorizer.Query(authorizerRules) // fs contains the my::type fact
With an imaginary example :
So how can we do it in your opinion ? Thank you very much :) |
Hello @Geal , Do you have any advice on our issue ? We need to keep the same behaviour, allowed in Java, but it does not seem possible in Golang without the requested evolution.. Or maybe you have a better idea ? Thank you ! |
Hello, Does anyone have an opinion ? |
Hi,
We're in charge of taking over a component that generates and consumes biscuits.
The component is developed in Java and we want to rewrite it in Go.
I wanted to retrieve a fact from a unmarshalled biscuit.
Example in Java of retrieving the facts (here, the first one)
And the biscuit
In Go, we have no function that allows us to get the facts of a biscuit...
I suppose it could be done by performing
Query
on theWorld
structure, and theBiscuit
structure has agenerateWorld
method that can create this neededWorld
, but it is private and only used by the tests...Is this a bug ?
Shouldn't it be available for consumption ?
If not, how can I retrieve the facts of an unmarshalled biscuit properly ? (no regex and other ugly stuff like that)
Thank you very much
The text was updated successfully, but these errors were encountered: