Update to new crystal-jwt APIs.
parent
66e2eaad48
commit
908f028322
|
@ -119,7 +119,7 @@ module AuthD
|
||||||
end
|
end
|
||||||
|
|
||||||
def decode_token(token)
|
def decode_token(token)
|
||||||
user, meta = JWT.decode token, @key, "HS256"
|
user, meta = JWT.decode token, @key, JWT::Algorithm::HS256
|
||||||
|
|
||||||
user = AuthD::User.from_json user.to_json
|
user = AuthD::User.from_json user.to_json
|
||||||
|
|
||||||
|
@ -135,7 +135,6 @@ module AuthD
|
||||||
|
|
||||||
response = read
|
response = read
|
||||||
|
|
||||||
pp! response.type
|
|
||||||
payload = String.new response.payload
|
payload = String.new response.payload
|
||||||
case ResponseTypes.new response.type.to_i
|
case ResponseTypes.new response.type.to_i
|
||||||
when ResponseTypes::Ok
|
when ResponseTypes::Ok
|
||||||
|
|
|
@ -58,7 +58,6 @@ IPC::Service.new "auth" do |event|
|
||||||
when IPC::Event::Message
|
when IPC::Event::Message
|
||||||
message = event.message
|
message = event.message
|
||||||
payload = message.payload
|
payload = message.payload
|
||||||
pp message
|
|
||||||
|
|
||||||
case RequestTypes.new message.type.to_i
|
case RequestTypes.new message.type.to_i
|
||||||
when RequestTypes::GetToken
|
when RequestTypes::GetToken
|
||||||
|
@ -79,7 +78,7 @@ IPC::Service.new "auth" do |event|
|
||||||
end
|
end
|
||||||
|
|
||||||
client.send ResponseTypes::Ok.value.to_u8,
|
client.send ResponseTypes::Ok.value.to_u8,
|
||||||
JWT.encode user.to_h, authd_jwt_key, "HS256"
|
JWT.encode user.to_h, authd_jwt_key, JWT::Algorithm::HS256
|
||||||
when RequestTypes::AddUser
|
when RequestTypes::AddUser
|
||||||
begin
|
begin
|
||||||
request = AddUserRequest.from_json String.new payload
|
request = AddUserRequest.from_json String.new payload
|
||||||
|
|
Loading…
Reference in New Issue