-
Notifications
You must be signed in to change notification settings - Fork 5
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
CSS-4603 Refactor toward using canonical/ofga
#990
Conversation
Signed-off-by: Babak K. Shandiz <[email protected]>
Signed-off-by: Babak K. Shandiz <[email protected]>
Signed-off-by: Babak K. Shandiz <[email protected]>
Signed-off-by: Babak K. Shandiz <[email protected]>
Signed-off-by: Babak K. Shandiz <[email protected]>
Signed-off-by: Babak K. Shandiz <[email protected]>
Signed-off-by: Babak K. Shandiz <[email protected]>
Signed-off-by: Babak K. Shandiz <[email protected]>
Signed-off-by: Babak K. Shandiz <[email protected]>
Signed-off-by: Babak K. Shandiz <[email protected]>
Signed-off-by: Babak K. Shandiz <[email protected]>
Signed-off-by: Babak K. Shandiz <[email protected]>
Signed-off-by: Babak K. Shandiz <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks like a good improvement with nice shifting of some logic to the library.
I would say we need more reviews on this though.
internal/jimm/access_test.go
Outdated
@@ -27,7 +27,7 @@ import ( | |||
// func TestJwtGenerator(t *testing.T) { | |||
// c := qt.New(t) | |||
|
|||
// _, client, _, err := jimmtest.SetupTestOFGAClient(c.Name()) | |||
// client, _, _, err := jimmtest.SetupTestOFGAClient(c.Name()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is commented out, do we still need it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks to @kian99, we made a card for this TODO and removed the code part.
@@ -89,7 +89,7 @@ func setupService(ctx context.Context, c *qt.C) (*jimm.Service, *httptest.Server | |||
err := store.CleanupJWKS(ctx) | |||
c.Assert(err, qt.IsNil) | |||
|
|||
_, ofgaClient, cfg, err := jimmtest.SetupTestOFGAClient(c.Name()) | |||
_, _, cofgaParams, err := jimmtest.SetupTestOFGAClient(c.Name()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cofga is kind of ambiguous
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it looks good to me, but won't approve until tests are all good and I'll go over it once more because it touches a lot of places. Also appears the new client is basically ours? Or at least inspired from ours?
Signed-off-by: Babak K. Shandiz <[email protected]>
Signed-off-by: Babak K. Shandiz <[email protected]>
Signed-off-by: Babak K. Shandiz <[email protected]>
Signed-off-by: Babak K. Shandiz <[email protected]>
Signed-off-by: Babak K. Shandiz <[email protected]>
Signed-off-by: Babak K. Shandiz <[email protected]>
Signed-off-by: Babak K. Shandiz <[email protected]>
Signed-off-by: Babak K. Shandiz <[email protected]>
Signed-off-by: Babak K. Shandiz <[email protected]>
Signed-off-by: Babak K. Shandiz <[email protected]>
Signed-off-by: Babak K. Shandiz <[email protected]>
Signed-off-by: Babak K. Shandiz <[email protected]>
Signed-off-by: Babak K. Shandiz <[email protected]>
Signed-off-by: Babak K. Shandiz <[email protected]>
internal/jimm/access_test.go
Outdated
@@ -27,7 +27,7 @@ import ( | |||
// func TestJwtGenerator(t *testing.T) { | |||
// c := qt.New(t) | |||
|
|||
// _, client, _, err := jimmtest.SetupTestOFGAClient(c.Name()) | |||
// client, _, _, err := jimmtest.SetupTestOFGAClient(c.Name()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
@@ -539,3 +492,14 @@ func key(candid *candidtest.Server, user string) *bakery.KeyPair { | |||
Private: bakery.PrivateKey{Key: bakery.Key(key.Private.Key)}, | |||
} | |||
} | |||
|
|||
func cofgaParamsToJIMMOpenFGAParams(cofgaParams cofga.OpenFGAParams) jimm.OpenFGAParams { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd godoc comment this to explain why
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm bar some comments
internal/jimmtest/suite.go
Outdated
} | ||
|
||
func (s *JIMMSuite) SetUpTest(c *gc.C) { | ||
ofgaAPI, ofgaClient, ofgaConfig, err := SetupTestOFGAClient(c.TestName()) | ||
ofgaClient, cofgaClient, cofgaConfig, err := SetupTestOFGAClient(c.TestName()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var err error
c.OFGAClient, c.OFGAClient, c.OFGAConfig, err = SetupTestOFGAClient(c.TestName())
@@ -2,10 +2,12 @@ | |||
|
|||
package names | |||
|
|||
import cofga "github.com/canonical/ofga" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no naming conflict here.. so i'd leave it as
import "github.com/canonical/ofga"
@@ -6,9 +6,9 @@ import ( | |||
"context" | |||
"sort" | |||
|
|||
cofga "github.com/canonical/ofga" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, no naming conflict so just import it as ofga...
"net/http" | ||
"os" | ||
"strconv" | ||
"strings" | ||
"time" | ||
|
||
"github.com/canonical/candid/candidclient" | ||
cofga "github.com/canonical/ofga" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
Signed-off-by: Babak K. Shandiz <[email protected]>
Signed-off-by: Babak K. Shandiz <[email protected]>
Signed-off-by: Babak K. Shandiz <[email protected]>
At the end I removed any unnecessary aliases to reference our internal |
Signed-off-by: Babak K. Shandiz <[email protected]>
Description
Refactored OpenFGA related packages to use canonical/ofga module.
Fixes CSS-4603
Engineering checklist
Check only items that apply
Test instructions
Notes for code reviewers