Skip to content

Commit

Permalink
feat: add consent expiry
Browse files Browse the repository at this point in the history
implement ENG-3797
  • Loading branch information
cowan-macady committed May 30, 2024
1 parent 04b714c commit 808f991
Show file tree
Hide file tree
Showing 10 changed files with 3,167 additions and 3,073 deletions.
30 changes: 19 additions & 11 deletions config/config_node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,11 @@ var _ = Describe("ConfigNode", func() {
Version: 0,
Config: &configpb.ConfigNode_ConsentConfig{
ConsentConfig: &configpb.ConsentConfiguration{
Purpose: "Taking control",
DataPoints: []string{"lastname", "firstname", "email"},
ApplicationId: "gid:like-real-application-id",
Purpose: "Taking control",
DataPoints: []string{"lastname", "firstname", "email"},
ApplicationId: "gid:like-real-application-id",
ValidityPeriod: uint64(86400),
RevokeAfterUse: true,
},
},
},
Expand Down Expand Up @@ -508,9 +510,11 @@ var _ = Describe("ConfigNode", func() {

It("CreateConsentConfiguration", func() {
configuration := &configpb.ConsentConfiguration{
Purpose: "Taking control",
DataPoints: []string{"lastname", "firstname", "email"},
ApplicationId: "gid:like-real-application-id",
Purpose: "Taking control",
DataPoints: []string{"lastname", "firstname", "email"},
ApplicationId: "gid:like-real-application-id",
ValidityPeriod: uint64(86400),
RevokeAfterUse: true,
}

configNodeRequest, err := config.NewCreate("like-real-config-node-name")
Expand All @@ -534,8 +538,10 @@ var _ = Describe("ConfigNode", func() {
"Location": Equal("gid:like-real-customer-id"),
"Config": PointTo(MatchFields(IgnoreExtras, Fields{
"ConsentConfig": PointTo(MatchFields(IgnoreExtras, Fields{
"Purpose": Equal("Taking control"),
"ApplicationId": Equal("gid:like-real-application-id"),
"Purpose": Equal("Taking control"),
"ApplicationId": Equal("gid:like-real-application-id"),
"ValidityPeriod": Equal(uint64(86400)),
"RevokeAfterUse": Equal(true),
})),
})),
}))),
Expand Down Expand Up @@ -875,9 +881,11 @@ var _ = Describe("ConfigNode", func() {

It("UpdateConsentConfiguration", func() {
configuration := &configpb.ConsentConfiguration{
Purpose: "Taking control",
DataPoints: []string{"lastname", "firstname", "email"},
ApplicationId: "gid:like-real-application-id",
Purpose: "Taking control",
DataPoints: []string{"lastname", "firstname", "email"},
ApplicationId: "gid:like-real-application-id",
ValidityPeriod: uint64(86400),
RevokeAfterUse: true,
}

configNodeRequest, err := config.NewUpdate("gid:like-real-config-node-id")
Expand Down
16 changes: 10 additions & 6 deletions examples/config/cmd/consent_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ var createConsentConfigCmd = &cobra.Command{
Short: "Create Consent configuration",
Run: func(cmd *cobra.Command, args []string) {
configuration := &configpb.ConsentConfiguration{
Purpose: "Taking control",
DataPoints: []string{"lastname", "firstname", "email"},
ApplicationId: "gid:AAAABMoo7PXYfkwepSVjj4GTtfc",
Purpose: "Taking control",
DataPoints: []string{"lastname", "firstname", "email"},
ApplicationId: "gid:AAAABMoo7PXYfkwepSVjj4GTtfc",
ValidityPeriod: 86400,
RevokeAfterUse: true,
}
createReq, _ := config.NewCreate("like-real-config-node-name")
createReq.ForLocation("gid:AAAAAvFyVpD_1kd8k2kpNY9rjFM")
Expand All @@ -64,9 +66,11 @@ var updateConsentConfigCmd = &cobra.Command{
Short: "Update Consent configuration",
Run: func(cmd *cobra.Command, args []string) {
configuration := &configpb.ConsentConfiguration{
Purpose: "Taking control upd",
DataPoints: []string{"lastname", "firstname", "email"},
ApplicationId: "gid:like-real-application-id",
Purpose: "Taking control upd",
DataPoints: []string{"lastname", "firstname", "email"},
ApplicationId: "gid:like-real-application-id",
ValidityPeriod: 86400,
RevokeAfterUse: true,
}
updateReq, _ := config.NewUpdate("gid:id-of-existing-config")
updateReq.WithConsentConfig(configuration)
Expand Down
2 changes: 1 addition & 1 deletion examples/tda/cmd/consent.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ var grantConsent = &cobra.Command{
},
},
ConsentId: consentId,
RevokeAfterUse: true,
ValidityPeriod: 86400,
},
retry.WithMax(2),
)
Expand Down
3,332 changes: 1,672 additions & 1,660 deletions gen/indykite/config/v1beta1/config_management_api.pb.go

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions gen/indykite/config/v1beta1/config_management_api.pb.validate.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 808f991

Please sign in to comment.