-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: move to buf generate and add .net 8.0 (#916)
BREAKING CHANGE: This makes the Zitadel.Grpc package obsolete. With buf, all gRPC sources are directly in the Zitadel package. To migrate, just remove the dependency to Zitadel.Grpc and use the Zitadel package instead.
- Loading branch information
Showing
60 changed files
with
2,875 additions
and
2,485 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,6 @@ bld/ | |
# Testing results | ||
coverage.json | ||
coverage.info | ||
|
||
# Generated Stuff | ||
*.g.cs |
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,12 +1,3 @@ | ||
[submodule "external/protoc-gen-validate"] | ||
path = external/protoc-gen-validate | ||
url = https://github.com/envoyproxy/protoc-gen-validate.git | ||
[submodule "external/grpc-gateway"] | ||
path = external/grpc-gateway | ||
url = https://github.com/grpc-ecosystem/grpc-gateway | ||
[submodule "external/googleapis"] | ||
path = external/googleapis | ||
url = https://github.com/googleapis/googleapis | ||
[submodule "external/zitadel"] | ||
path = external/zitadel | ||
url = https://github.com/zitadel/zitadel |
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
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
version: v1 | ||
managed: | ||
enabled: true | ||
csharp_namespace: | ||
|
||
plugins: | ||
- plugin: buf.build/protocolbuffers/csharp | ||
out: src/Zitadel/Api/Generated | ||
opt: | ||
- base_namespace= | ||
- file_extension=.g.cs | ||
- plugin: buf.build/grpc/csharp | ||
out: src/Zitadel/Api/Generated | ||
opt: | ||
- base_namespace= | ||
- no_server | ||
- file_suffix=Grpc.g.cs |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
// This file contains two examples: | ||
// 1. An example with a service account "personal access token" to access the ZITADEL API. | ||
// 2. An example with a service account "jwt profile key" to access the ZITADEL API. | ||
|
||
using Zitadel.Api; | ||
using Zitadel.Credentials; | ||
|
||
const string apiUrl = "https://zitadel-libraries-l8boqa.zitadel.cloud"; | ||
const string personalAccessToken = "ge85fvmgTX4XAhjpF0XGpelB2vn9LZanJaqmUQDuf7iTpKVowb44LFl-86pqY2mfJCEoIOk"; | ||
|
||
// or create the token provider directly: | ||
// new StaticTokenProvider(token) | ||
var client = Clients.AuthService(new(apiUrl, ITokenProvider.Static(personalAccessToken))); | ||
var result = await client.GetMyUserAsync(new()); | ||
Console.WriteLine($"User: {result.User}"); | ||
|
||
var serviceAccount = ServiceAccount.LoadFromJsonString( | ||
@" | ||
{ | ||
""type"": ""serviceaccount"", | ||
""keyId"": ""170084658355110145"", | ||
""key"": ""-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEAnQisbU4FuLmjLR9I2Q01Rm9Mx6WySat2mbxgmOzu04oXuESI\nyS+RkiimdN0khjqouBftYqtVes7yngMLq3E8hMCwv/kLE+YeXphZXnn8tps8M2gV\n7S//uCp9LooK9qeh0lSkOqIsh0atj/l7NAHFxnhuNhfmn8XIYJNLVNSj5yzTri5E\nSn92SAsUQLSONgr7IEmIjcuPtYeU0iLvVno52ljZHnPX2WJ0HEZv44nZpkR4qBfv\n3hJzNx7sd4TdPGHHugJD8jdG/X4bAxwL5XGHZu18cUVM5RerSMpFQHSuIGgpKmK4\nWlM1AJGeut6EX/SrCxUDvhyOnXAgqhunTUmi6QIDAQABAoIBAHn7y92Y1y743X3m\nqHMbJIBTYyRPXaCGljm0MKF6o8clpWlZq5wE3KLZ+vwa8Q1oMbnXtGqKR3t/mM4P\n9Ze2/djtyh9GOUm632qCFCIkxp+fFPOl7ipyt8V7FAT77KpP6490eqKlacunppmJ\nph/vJJAY6xwQEvGX9SC4KrN5/txLKXbVtR3V2RXy9sxbbL4cpnklmRBMeXQkpwEM\nTKELUr5Rmhg9KvS3yALgVv0dIRtOA8Z995R234hXfY0St48YEvZtsxeme47u2CVl\nHJcVH4aa9Sw6XlgAEQBxqbQHpcLvUIu3XempO7VfGklWE6OlGuEcnUWpJCD8jMZW\nPYtt9LUCgYEAwi8josS3Iyto+DMJjJKCw175N2cmFMxBGu9Rw4aHjTiN57z7AUkn\nbmT44WnSmc1bCLC+nMB34vhiEyBKXYrH7zgbeMO8QDG3aO6gXdod/IdsieZR8E3b\ngUA1wtZYyRbc7eo8U4Nqkv1NXVRuDJkz/Mfoy+m1BVKcW7YeZaaZN9MCgYEAzwYB\n/LAiJoyx5UPwuieizlT7kHI7uvZRo4oLx+cZipNCJ0NGKgX4l1NIYLaNDbCoT9N0\nylico+kn+nihzDmD6SjY2hHGSIHk7AnJOcW+Bk5TfsYb8clxfgX40udLMIS0F13R\nrJt0gD9x0O3AZv4MV9cSI0/Md0tbWePgrLI44NMCgYEAojj7TlmEnY8AbIlGqvci\n4tCO5qf3elyA712LMwtKZsIeWsDX+OUCWglkmfvsAq06JfJx60YnYagbVtsdBTSR\nftmiqarrs71U+gaQVpeHgZYpKLMPNO/2Nu5Le2/SUHwXKXML3sDk4dNXNGb6YPAE\nLGNdqiyeG8o98agdkNIzIh0CgYEAlTGhMPfGRL3UXoNN8vopjEUWXozUmvJ090S/\nJLtZXtKtNBp5cEOJWZT9biVhFeKgCZc8ba7ahA29b/aLs+AnPlrfnJh+qzZhQfHz\ngJ0PSwAbkBs5fFBOaCHppiRlvXuFRemo95m4pcwTPBx7Mj4Xqx4lxij2E2rNVMSy\n4AI4l10CgYBwefqXt8B+D+0EvmhyHk19Tk8/fPelclJUv/IVI59c0F9UMAA2rD1U\nNW6k9251OGU7mQkztluNvl13qtAW/DveOjkFeDJIMzhFjravpLQXhUK4ETnM44YL\nFbClVGJaHYSHgOkNpcN5lYVLoyEvzv9rEPwBqpZRVnwWj6L+/I2L5Q==\n-----END RSA PRIVATE KEY-----\n"", | ||
""userId"": ""170079991923474689"" | ||
}"); | ||
client = Clients.AuthService( | ||
new( | ||
apiUrl, | ||
ITokenProvider.ServiceAccount( | ||
apiUrl, | ||
serviceAccount, | ||
new() { ApiAccess = true }))); | ||
result = await client.GetMyUserAsync(new()); | ||
Console.WriteLine($"User: {result.User}"); | ||
// This file contains two examples: | ||
// 1. An example with a service account "personal access token" to access the ZITADEL API. | ||
// 2. An example with a service account "jwt profile key" to access the ZITADEL API. | ||
|
||
using Zitadel.Api; | ||
using Zitadel.Credentials; | ||
|
||
const string apiUrl = "https://zitadel-libraries-l8boqa.zitadel.cloud"; | ||
const string personalAccessToken = "ge85fvmgTX4XAhjpF0XGpelB2vn9LZanJaqmUQDuf7iTpKVowb44LFl-86pqY2mfJCEoIOk"; | ||
|
||
// or create the token provider directly: | ||
// new StaticTokenProvider(token) | ||
var client = Clients.AuthService(new(apiUrl, ITokenProvider.Static(personalAccessToken))); | ||
var result = await client.GetMyUserAsync(new()); | ||
Console.WriteLine($"User: {result.User}"); | ||
|
||
var serviceAccount = ServiceAccount.LoadFromJsonString( | ||
@" | ||
{ | ||
""type"": ""serviceaccount"", | ||
""keyId"": ""170084658355110145"", | ||
""key"": ""-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEAnQisbU4FuLmjLR9I2Q01Rm9Mx6WySat2mbxgmOzu04oXuESI\nyS+RkiimdN0khjqouBftYqtVes7yngMLq3E8hMCwv/kLE+YeXphZXnn8tps8M2gV\n7S//uCp9LooK9qeh0lSkOqIsh0atj/l7NAHFxnhuNhfmn8XIYJNLVNSj5yzTri5E\nSn92SAsUQLSONgr7IEmIjcuPtYeU0iLvVno52ljZHnPX2WJ0HEZv44nZpkR4qBfv\n3hJzNx7sd4TdPGHHugJD8jdG/X4bAxwL5XGHZu18cUVM5RerSMpFQHSuIGgpKmK4\nWlM1AJGeut6EX/SrCxUDvhyOnXAgqhunTUmi6QIDAQABAoIBAHn7y92Y1y743X3m\nqHMbJIBTYyRPXaCGljm0MKF6o8clpWlZq5wE3KLZ+vwa8Q1oMbnXtGqKR3t/mM4P\n9Ze2/djtyh9GOUm632qCFCIkxp+fFPOl7ipyt8V7FAT77KpP6490eqKlacunppmJ\nph/vJJAY6xwQEvGX9SC4KrN5/txLKXbVtR3V2RXy9sxbbL4cpnklmRBMeXQkpwEM\nTKELUr5Rmhg9KvS3yALgVv0dIRtOA8Z995R234hXfY0St48YEvZtsxeme47u2CVl\nHJcVH4aa9Sw6XlgAEQBxqbQHpcLvUIu3XempO7VfGklWE6OlGuEcnUWpJCD8jMZW\nPYtt9LUCgYEAwi8josS3Iyto+DMJjJKCw175N2cmFMxBGu9Rw4aHjTiN57z7AUkn\nbmT44WnSmc1bCLC+nMB34vhiEyBKXYrH7zgbeMO8QDG3aO6gXdod/IdsieZR8E3b\ngUA1wtZYyRbc7eo8U4Nqkv1NXVRuDJkz/Mfoy+m1BVKcW7YeZaaZN9MCgYEAzwYB\n/LAiJoyx5UPwuieizlT7kHI7uvZRo4oLx+cZipNCJ0NGKgX4l1NIYLaNDbCoT9N0\nylico+kn+nihzDmD6SjY2hHGSIHk7AnJOcW+Bk5TfsYb8clxfgX40udLMIS0F13R\nrJt0gD9x0O3AZv4MV9cSI0/Md0tbWePgrLI44NMCgYEAojj7TlmEnY8AbIlGqvci\n4tCO5qf3elyA712LMwtKZsIeWsDX+OUCWglkmfvsAq06JfJx60YnYagbVtsdBTSR\nftmiqarrs71U+gaQVpeHgZYpKLMPNO/2Nu5Le2/SUHwXKXML3sDk4dNXNGb6YPAE\nLGNdqiyeG8o98agdkNIzIh0CgYEAlTGhMPfGRL3UXoNN8vopjEUWXozUmvJ090S/\nJLtZXtKtNBp5cEOJWZT9biVhFeKgCZc8ba7ahA29b/aLs+AnPlrfnJh+qzZhQfHz\ngJ0PSwAbkBs5fFBOaCHppiRlvXuFRemo95m4pcwTPBx7Mj4Xqx4lxij2E2rNVMSy\n4AI4l10CgYBwefqXt8B+D+0EvmhyHk19Tk8/fPelclJUv/IVI59c0F9UMAA2rD1U\nNW6k9251OGU7mQkztluNvl13qtAW/DveOjkFeDJIMzhFjravpLQXhUK4ETnM44YL\nFbClVGJaHYSHgOkNpcN5lYVLoyEvzv9rEPwBqpZRVnwWj6L+/I2L5Q==\n-----END RSA PRIVATE KEY-----\n"", | ||
""userId"": ""170079991923474689"" | ||
}"); | ||
client = Clients.AuthService( | ||
new( | ||
apiUrl, | ||
ITokenProvider.ServiceAccount( | ||
apiUrl, | ||
serviceAccount, | ||
new() { ApiAccess = true }))); | ||
result = await client.GetMyUserAsync(new()); | ||
Console.WriteLine($"User: {result.User}"); |
32 changes: 16 additions & 16 deletions
32
examples/Zitadel.AspNet.AuthN/Pages/Authenticated.cshtml.cs
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,16 +1,16 @@ | ||
using Microsoft.AspNetCore.Authentication; | ||
using Microsoft.AspNetCore.Authorization; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.RazorPages; | ||
|
||
namespace Zitadel.AspNet.AuthN.Pages; | ||
|
||
[Authorize] | ||
public class Authenticated : PageModel | ||
{ | ||
public async Task<IActionResult> OnPostAsync() | ||
{ | ||
await HttpContext.SignOutAsync(); | ||
return RedirectToPage("/Index"); | ||
} | ||
} | ||
using Microsoft.AspNetCore.Authentication; | ||
using Microsoft.AspNetCore.Authorization; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.RazorPages; | ||
|
||
namespace Zitadel.AspNet.AuthN.Pages; | ||
|
||
[Authorize] | ||
public class Authenticated : PageModel | ||
{ | ||
public async Task<IActionResult> OnPostAsync() | ||
{ | ||
await HttpContext.SignOutAsync(); | ||
return RedirectToPage("/Index"); | ||
} | ||
} |
Oops, something went wrong.