Archived
3
0

Crystal bindings: authd compiles.

This commit is contained in:
Philippe Pittoli 2023-02-01 20:32:21 +01:00
parent bfdbacb981
commit 2192f44ffc
4 changed files with 34 additions and 6 deletions

View File

@ -1,4 +1,4 @@
require "ipc/json"
require "../src/json"
module AuthD
class Client < IPC

View File

@ -42,7 +42,7 @@ class AuthD::Service < IPC
property last_uid_file : String
def initialize(@configuration)
super
super()
@users = DODB::DataBase(User).new @configuration.storage
@users_per_uid = @users.new_index "uid", &.uid.to_s
@ -81,7 +81,10 @@ class AuthD::Service < IPC
def handle_request(event : IPC::Event)
request_start = Time.utc
request = AuthD.requests.parse_ipc_json event.message.not_nil!
array = event.message.not_nil!
slice = Slice.new array.to_unsafe, array.size
message = IPCMessage::TypedMessage.deserialize slice
request = AuthD.requests.parse_ipc_json message.not_nil!
if request.nil?
raise "unknown request type"

View File

@ -15,11 +15,18 @@ valgrind:
run:
LD_LIBRARY_PATH=$(LDPATH) $(SRC)
run-pongd:
LD_LIBRARY_PATH=$(LDPATH) ./bin/pongd
build-pongd:
CRYSTAL_LIBRARY_PATH=$(LDPATH) shards build pongd
run-pongd:
LD_LIBRARY_PATH=$(LDPATH) ./bin/pongd
build-authd:
CRYSTAL_LIBRARY_PATH=$(LDPATH) shards build authd
run-authd:
LD_LIBRARY_PATH=$(LDPATH) ./bin/authd
run-test:
crystal run src/libauth.cr

View File

@ -9,7 +9,25 @@ targets:
main: src/main.cr
pongd:
main: src/pongd.cr
authd:
main: authd/main.cr
crystal: 1.7.1
dependencies:
grok:
github: spinscale/grok.cr
passwd:
git: https://git.baguette.netlib.re/Baguette/passwd.cr
branch: master
jwt:
github: crystal-community/jwt
branch: master
baguette-crystal-base:
git: https://git.baguette.netlib.re/Baguette/baguette-crystal-base
branch: master
dodb:
git: https://git.baguette.netlib.re/Baguette/dodb.cr
branch: master
license: MIT