nullnet-wallguard-server 0.2.0

A centralized management system for network firewalls
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use nullnet_liberror::{location, Error, ErrorHandler, Location};
use nullnet_libtoken::Token;

use crate::{grpc_server::server::WallGuardImpl, proto::wallguard::Authentication};

impl WallGuardImpl {
    pub(crate) fn authenticate(auth: Option<Authentication>) -> Result<(String, Token), Error> {
        let Some(auth_message) = auth else {
            return Err("Authentication token is missing").handle_err(location!());
        };

        let jwt_token = auth_message.token.clone();

        let token_info = Token::from_jwt(&jwt_token).handle_err(location!())?;

        Ok((jwt_token, token_info))
    }
}