pub(crate) fn check_authorized(
        &self,
        client_addr: Remote<ClientAddr>,
        tls: &tls::ConditionalServerTls,
    ) -> Result<Permit, DeniedUnauthorized> {
        let server = self.server.borrow();
        for authz in server.authorizations.iter() {
            if authz.networks.iter().any(|n| n.contains(&client_addr.ip())) {
                match authz.authentication {
                    Authentication::Unauthenticated => {
                        return Ok(Permit::new(self.dst, &*server, authz));
                    }

                    Authentication::TlsUnauthenticated => {
                        if let tls::ConditionalServerTls::Some(tls::ServerTls::Established {
                            ..
                        }) = tls
                        {
                            return Ok(Permit::new(self.dst, &*server, authz));
                        }
                    }

                    Authentication::TlsAuthenticated {
                        ref identities,
                        ref suffixes,
                    } => {
                        if let tls::ConditionalServerTls::Some(tls::ServerTls::Established {
                            client_id: Some(tls::server::ClientId(ref id)),
                            ..
                        }) = tls
                        {
                            if identities.contains(id.as_str())
                                || suffixes.iter().any(|s| s.contains(id.as_str()))
                            {
                                return Ok(Permit::new(self.dst, &*server, authz));
                            }
                        }
                    }
                }
            }
        }

        Err(DeniedUnauthorized {
            kind: server.kind.clone(),
            name: server.name.clone(),
        })
    }
/// Checks whether the destination port's `AllowPolicy` is authorized to
/// accept connections given the provided TLS state.
Checks whether the destination port's `AllowPolicy` is authorized to
accept connections given the provided TLS state.
Checks whether the destination port ' s ` AllowPolicy ` is authorized to accept connections given the provided TLS state .
pub(crate) fn check_authorized(
        &self,
        client_addr: Remote<ClientAddr>,
        tls: &tls::ConditionalServerTls,
    ) -> Result<Permit, DeniedUnauthorized> {
        let server = self.server.borrow();
        for authz in server.authorizations.iter() {
            if authz.networks.iter().any(|n| n.contains(&client_addr.ip())) {
                match authz.authentication {
                    Authentication::Unauthenticated => {
                        return Ok(Permit::new(self.dst, &*server, authz));
                    }
                    Authentication::TlsUnauthenticated => {
                        if let tls::ConditionalServerTls::Some(tls::ServerTls::Established {
                            ..
                        }) = tls
                        {
                            return Ok(Permit::new(self.dst, &*server, authz));
                        }
                    }
                    Authentication::TlsAuthenticated {
                        ref identities,
                        ref suffixes,
                    } => {
                        if let tls::ConditionalServerTls::Some(tls::ServerTls::Established {
                            client_id: Some(tls::server::ClientId(ref id)),
                            ..
                        }) = tls
                        {
                            if identities.contains(id.as_str())
                                || suffixes.iter().any(|s| s.contains(id.as_str()))
                            {
                                return Ok(Permit::new(self.dst, &*server, authz));
                            }
                        }
                    }
                }
            }
        }
        Err(DeniedUnauthorized {
            kind: server.kind.clone(),
            name: server.name.clone(),
        })
    }
pub ( crate ) fn check_authorized ( & self , client_addr : Remote < ClientAddr > , tls : & tls :: ConditionalServerTls , ) -> Result < Permit , DeniedUnauthorized > { let server = self . server . borrow ( ) ; for authz in server . authorizations . iter ( ) { if authz . networks . iter ( ) . any ( | n | n . contains ( & client_addr . ip ( ) ) ) { match authz . authentication { Authentication :: Unauthenticated => { return Ok ( Permit :: new ( self . dst , & * server , authz ) ) ; } Authentication :: TlsUnauthenticated => { if let tls :: ConditionalServerTls :: Some ( tls :: ServerTls :: Established { .. } ) = tls { return Ok ( Permit :: new ( self . dst , & * server , authz ) ) ; } } Authentication :: TlsAuthenticated { ref identities , ref suffixes , } => { if let tls :: ConditionalServerTls :: Some ( tls :: ServerTls :: Established { client_id : Some ( tls :: server :: ClientId ( ref id ) ) , .. } ) = tls { if identities . contains ( id . as_str ( ) ) || suffixes . iter ( ) . any ( | s | s . contains ( id . as_str ( ) ) ) { return Ok ( Permit :: new ( self . dst , & * server , authz ) ) ; } } } } } } Err ( DeniedUnauthorized { kind : server . kind . clone ( ) , name : server . name . clone ( ) , } ) }
Checks whether the destination port's `AllowPolicy` is authorized to
accept connections given the provided TLS state.
Checks whether the destination port ' s ` AllowPolicy ` is authorized to accept connections given the provided TLS state .
&self
client_addr
Remote<ClientAddr>
tls
&tls::ConditionalServerTls