Obsolete
/
libipc-old
Archived
3
0
Fork 0

Crystal bindings: authd compiles.

master
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 module AuthD
class Client < IPC class Client < IPC

View File

@ -42,7 +42,7 @@ class AuthD::Service < IPC
property last_uid_file : String property last_uid_file : String
def initialize(@configuration) def initialize(@configuration)
super super()
@users = DODB::DataBase(User).new @configuration.storage @users = DODB::DataBase(User).new @configuration.storage
@users_per_uid = @users.new_index "uid", &.uid.to_s @users_per_uid = @users.new_index "uid", &.uid.to_s
@ -81,7 +81,10 @@ class AuthD::Service < IPC
def handle_request(event : IPC::Event) def handle_request(event : IPC::Event)
request_start = Time.utc 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? if request.nil?
raise "unknown request type" raise "unknown request type"

View File

@ -15,11 +15,18 @@ valgrind:
run: run:
LD_LIBRARY_PATH=$(LDPATH) $(SRC) LD_LIBRARY_PATH=$(LDPATH) $(SRC)
run-pongd:
LD_LIBRARY_PATH=$(LDPATH) ./bin/pongd
build-pongd: build-pongd:
CRYSTAL_LIBRARY_PATH=$(LDPATH) shards 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: run-test:
crystal run src/libauth.cr crystal run src/libauth.cr

View File

@ -9,7 +9,25 @@ targets:
main: src/main.cr main: src/main.cr
pongd: pongd:
main: src/pongd.cr main: src/pongd.cr
authd:
main: authd/main.cr
crystal: 1.7.1 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 license: MIT