global::auth
Authentication mechanisms and credential manipulation.
fn
credentials
fn credentials() -> Credentials
details
Get authentication credentials from the client.
Effective smtp stage
authenticate
only.
Return
Credentials
- the credentials of the client.
Example
#{
authenticate: [
action "log auth" || log("info", `${auth::credentials()}`),
]
}
get
anonymous_token
fn get anonymous_token(credentials: Credentials) -> String
details
Get the anonymous_token
property of the connection.
Can only be use on ‘AnonymousToken’ authentication typed credentials.
Effective smtp stage
authenticate
only.
Return
String
- the token.
Examples
#{
authenticate: [
action "log auth token" || {
let credentials = auth::credentials();
log("info", `credentials token: ${credentials.anonymous_token}`);
},
]
}
get
authid
fn get authid(credentials: Credentials) -> String
details
Get the authid
property of the connection.
Can only be use on ‘Verify’ authentication typed credentials.
Effective smtp stage
authenticate
only.
Return
String
- the authentication id.
Examples
#{
authenticate: [
action "log auth id" || {
let credentials = auth::credentials();
log("info", `credentials id: ${credentials.authid}`);
},
]
}
get
authpass
fn get authpass(credentials: Credentials) -> String
details
Get the authpass
property of the connection.
Can only be use on ‘Verify’ authentication typed credentials.
Effective smtp stage
authenticate
only.
Return
String
- the authentication password.
Examples
#{
authenticate: [
action "log auth pass" || {
let credentials = auth::credentials();
log("info", `credentials pass: ${credentials.authpass}`);
},
]
}
get
type
fn get type(credentials: Credentials) -> String
details
Get the type of the auth
property of the connection.
Effective smtp stage
authenticate
only.
Return
String
- the credentials type.
Examples
#{
authenticate: [
action "log auth type" || {
let credentials = auth::credentials();
// Logs here will output 'Verify' or 'AnonymousToken'.
// depending on the authentication type.
log("info", `credentials type: ${credentials.type}`);
},
]
}
fn
is_authenticated
fn is_authenticated() -> bool
details
Check if the client is authenticated.
Effective smtp stage
authenticate
stage only.
Return
bool
-true
if the client succeeded to authenticate itself,false
otherwise.
Example
#{
authenticate: [
action "log info" || log("info", `client authenticated: ${auth::is_authenticated()}`),
]
}
fn
unix_users
fn unix_users() -> Status
details
Process the SASL authentication mechanism.
The current implementation support “PLAIN” mechanism, and will call the
testsaslauthd
program to check the credentials.
The credentials will be verified depending on the mode of saslauthd
.
A native implementation will be provided in the future.