mirror of
https://github.com/cubixle/radius-rs.git
synced 2026-04-29 19:28:45 +01:00
Typesafe lookup
This commit is contained in:
+2
-8
@@ -46,14 +46,8 @@ impl RequestHandler<(), io::Error> for MyRequestHandler {
|
||||
let maybe_user_name_attr = rfc2865::lookup_user_name(req_packet);
|
||||
let maybe_user_password_attr = rfc2865::lookup_user_password(req_packet);
|
||||
|
||||
let user_name = maybe_user_name_attr.unwrap().decode_string().unwrap();
|
||||
let user_password = String::from_utf8(
|
||||
maybe_user_password_attr
|
||||
.unwrap()
|
||||
.decode_user_password(req_packet.get_secret(), req_packet.get_authenticator())
|
||||
.unwrap(),
|
||||
)
|
||||
.unwrap();
|
||||
let user_name = maybe_user_name_attr.unwrap().unwrap();
|
||||
let user_password = String::from_utf8(maybe_user_password_attr.unwrap().unwrap()).unwrap();
|
||||
let code = if user_name == "admin" && user_password == "p@ssw0rd" {
|
||||
Code::AccessAccept
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user