-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: move permissions to shared, a new token proto (#192)
- Loading branch information
1 parent
36e897d
commit ce843d6
Showing
13 changed files
with
193 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export * as cache from './CacheclientServiceClientPb' | ||
export * as control from './ControlclientServiceClientPb' | ||
export * as auth from './AuthServiceClientPb' | ||
export * as token from './TokenServiceClientPb' | ||
export * as ping from './CachepingServiceClientPb' |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+16.3 KB
(110%)
kotlin-messages/kotlin/messages/generated-sources/descriptors/client_protos.dsc
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
syntax = "proto3"; | ||
|
||
option go_package = "github.com/momentohq/client-sdk-go;client_sdk_go"; | ||
option java_multiple_files = true; | ||
option java_package = "momento.shared.permissions"; | ||
|
||
package permissions; | ||
|
||
// Aliases for categories of functionality. | ||
enum CacheRole { | ||
CachePermitNone = 0; | ||
// Restricts access to apis that read and write data from caches: No higher level resource description or modification. | ||
CacheReadWrite = 1; | ||
// Restricts access to apis that read from caches: No higher level resource description or modification. | ||
CacheReadOnly = 2; | ||
// Doesn't allow conditional write APIs (SetIfNotExists, IncreaseTTL etc) | ||
CacheWriteOnly = 3; | ||
} | ||
|
||
// Aliases for categories of functionality. | ||
enum TopicRole { | ||
TopicPermitNone = 0; | ||
// Restricts access to apis that read and write data from topics: No higher level resource description or modification. | ||
TopicReadWrite = 1; | ||
// Restricts access to apis that read from topics: No higher level resource description or modification. | ||
TopicReadOnly = 2; | ||
// Only publish allowed | ||
TopicWriteOnly = 3; | ||
} | ||
|
||
enum SuperUserPermissions { | ||
SuperUser = 0; | ||
} | ||
|
||
message Permissions { | ||
oneof kind { | ||
SuperUserPermissions super_user = 1; | ||
ExplicitPermissions explicit = 2; | ||
} | ||
} | ||
|
||
message ExplicitPermissions { | ||
repeated PermissionsType permissions = 1; | ||
} | ||
|
||
message PermissionsType { | ||
oneof kind { | ||
CachePermissions cache_permissions = 1; | ||
TopicPermissions topic_permissions = 2; | ||
} | ||
|
||
message All {} | ||
|
||
message CacheSelector { | ||
oneof kind { | ||
string cache_name = 1; | ||
} | ||
} | ||
|
||
message CacheItemSelector { | ||
oneof kind { | ||
bytes key = 1; | ||
bytes key_prefix = 2; | ||
} | ||
} | ||
|
||
message CachePermissions { | ||
CacheRole role = 1; | ||
oneof cache { | ||
All all_caches = 2; | ||
CacheSelector cache_selector = 3; | ||
} | ||
oneof cache_item { | ||
All all_items = 4; | ||
CacheItemSelector item_selector = 5; | ||
} | ||
} | ||
|
||
message TopicSelector { | ||
oneof kind { | ||
string topic_name = 1; | ||
} | ||
} | ||
|
||
message TopicPermissions { | ||
TopicRole role = 1; | ||
oneof cache { | ||
All all_caches = 2; | ||
CacheSelector cache_selector = 3; | ||
} | ||
oneof topic { | ||
All all_topics = 4; | ||
TopicSelector topic_selector = 5; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
syntax = "proto3"; | ||
|
||
import "permissions.proto"; | ||
|
||
option go_package = "github.com/momentohq/client-sdk-go;client_sdk_go"; | ||
option java_multiple_files = true; | ||
option java_package = "momento.token"; | ||
|
||
package token; | ||
|
||
service Token { | ||
rpc GenerateAuthAcorn (_GenerateAuthAcornRequest) returns (_GenerateAuthAcornResponse) {} | ||
} | ||
|
||
message _GenerateAuthAcornRequest { | ||
// generate a token that has an expiry | ||
message Expires { | ||
// how many seconds do you want the api token to be valid for? | ||
uint32 valid_for_seconds = 1; | ||
} | ||
|
||
Expires expires = 1; | ||
|
||
string auth_token = 2; | ||
|
||
permissions.Permissions permissions = 3; | ||
} | ||
|
||
message _GenerateAuthAcornResponse { | ||
// the new api key used for authentication against Momento backend | ||
string api_key = 1; | ||
// the Momento endpoint that this token is allowed to make requests against | ||
string endpoint = 2; | ||
// epoch seconds when the api token expires | ||
uint64 valid_until = 3; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.