Lather.Auth.WSSecurity (lather v1.0.42)
View SourceWS-Security implementation for SOAP authentication.
This module provides WS-Security authentication mechanisms including:
- UsernameToken authentication
- Timestamp elements
- Nonce generation
- Password digest generation
Summary
Functions
Creates a WS-Security timestamp header.
Creates a WS-Security UsernameToken header.
Creates a combined WS-Security header with both UsernameToken and Timestamp.
Functions
Creates a WS-Security timestamp header.
Parameters
options- Options for the timestamp:ttl- Time to live in seconds (default: 300)
Examples
iex> Lather.Auth.WSSecurity.timestamp()
%{
"Security" => %{
"Timestamp" => %{
"Created" => "2023-01-01T12:00:00Z",
"Expires" => "2023-01-01T12:05:00Z"
}
}
}
Creates a WS-Security UsernameToken header.
Parameters
username- The username for authenticationpassword- The password for authenticationoptions- Additional options:password_type-:digestor:text(default::text):include_nonce- Whether to include a nonce (default:truefor digest):include_created- Whether to include timestamp (default:true)
Examples
iex> Lather.Auth.WSSecurity.username_token("admin", "password")
%{
"Security" => %{
"UsernameToken" => %{
"Username" => "admin",
"Password" => %{"#text" => "password", "@Type" => "...PasswordText"}
}
}
}
Creates a combined WS-Security header with both UsernameToken and Timestamp.
Parameters
username- The username for authenticationpassword- The password for authenticationoptions- Combined options for both UsernameToken and Timestamp
Examples
iex> Lather.Auth.WSSecurity.username_token_with_timestamp("admin", "password")
%{
"Security" => %{
"UsernameToken" => %{...},
"Timestamp" => %{...}
}
}