diff options
| author | mo khan <mo@mokhan.ca> | 2025-03-06 11:24:42 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-03-06 11:24:42 -0700 |
| commit | 27e5b886ad9e9e4c0d831162dbae9d9025fb2903 (patch) | |
| tree | 32c00563a2d93d82dbeefece715a2cbaeba6d41b /bin | |
| parent | 0fb8fe928b9ca6f907d532789038f8b8fdcca42c (diff) | |
refactor: use protobuf3 and define twirp service
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/api | 5 | ||||
| -rwxr-xr-x | bin/idp | 1 | ||||
| -rwxr-xr-x | bin/rpc | 4 | ||||
| -rwxr-xr-x | bin/ui | 1 |
4 files changed, 7 insertions, 4 deletions
@@ -79,8 +79,8 @@ class API def authorized?(request, permission) # TODO:: Check the JWT for the appropriate claim # Connect to the Authz RPC endpoint Ability.allowed?(subject, permission, resource) - client = ::Ability::Stub.new('localhost:50051', :this_channel_is_insecure) # TODO:: memorize client - reply = client.allowed(AllowRequest.new(subject: "", permission: permission, resource: "")) + client = ::Authx::Ability::Stub.new('localhost:50051', :this_channel_is_insecure) # TODO:: memorize client + reply = client.allowed(::Authx::AllowRequest.new(subject: "", permission: permission, resource: "")) puts "***" * 10 puts reply.inspect puts "***" * 10 @@ -119,6 +119,7 @@ end if __FILE__ == $0 app = Rack::Builder.new do + use Rack::CommonLogger use Rack::Reloader run API.new end.to_app @@ -328,6 +328,7 @@ end if __FILE__ == $0 app = Rack::Builder.new do + use Rack::CommonLogger use Rack::Reloader run IdentityProvider.new end.to_app @@ -22,12 +22,12 @@ class ProjectPolicy < DeclarativePolicy::Base rule { owner }.enable :create_project end -class AbilityHandler < ::Ability::Service +class AbilityHandler < ::Authx::Ability::Service def allowed(request, _call) puts [request, _call].inspect GRPC.logger.info([request, _call].inspect) - AllowReply.new(result: true) + ::Authx::AllowReply.new(result: true) # TODO:: entrypoint to declarative policies # AllowReply.new(result: policy_for(request).can?(request.permission)) end @@ -156,6 +156,7 @@ end if __FILE__ == $0 app = Rack::Builder.new do + use Rack::CommonLogger use Rack::Reloader run UI.new end.to_app |
