Module sipauth

SIP authentication functions.

Introduced in: 15 Nov 2002 by Magnus Ahltorp <ahltorp@nada.kth.se>

Authors: Magnus Ahltorp (ahltorp@nada.kth.se).

Description

SIP authentication functions.

Function Index

add_credentials/7 Compute and add a MD5 digest response header (HeaderName) to a header.
add_x_yxa_peer_auth/5 Compute and add an X-YXA-Peer-Auth header to Header.
can_register/2 Check if a REGISTER message authenticates OK, and check that the User returned from credentials check actually may use this To: (NOT From:, so third party registrations are not denied per se by this check).
can_use_address/2 Check if a given User may use address Address as From: by using the function can_use_address_detail/2 not caring about the reason it returns.
can_use_address_detail/2 Check if a given User may use address Address as From:.
classify_number/2 Search a list of regexps until Number matches the Regexp and return the Class.
get_challenge/0 Create a challenge tuple.
get_nonce/1 Create a nonce.
get_response/5Equivalent to get_response(Nonce, Method, URIstr, User, Password, realm()).
get_response/6 Get the correct response to a challenge, given a nonce, method, URI, username and password.
get_user_verified/2 Check if there is an Authorization: header in Header and check if it contains a valid response of a challenge we supposedly sent out.
get_user_verified_proxy/2 Check if there is an Proxy-Authorization: header in Header and check if it contains a valid response of a challenge we supposedly sent out.
is_allowed_pstn_dst/4 Check if a given User is explicitly allowed to call a number in a given Class.
pstn_get_user_verified/2 Authenticate through X-YXA-Peer-Auth or, if that does not exist, through Proxy-Authentication.
realm/0 Return this proxys configured authentication realm, or the hostname if no realm has been configured.

Function Details

add_credentials/7

add_credentials(X1::Type, HeaderName, Method, URI, Header, User, Secret) -> NewHeader

Compute and add a MD5 digest response header (HeaderName) to a header.

add_x_yxa_peer_auth/5

add_x_yxa_peer_auth(Method, URI, Header, User, Secret) -> NewHeader

Compute and add an X-YXA-Peer-Auth header to Header.

can_register/2

can_register(Header, ToURL) -> {{Verdict, Reason}, User} | {stale, User} | {false, none}

Check if a REGISTER message authenticates OK, and check that the User returned from credentials check actually may use this To: (NOT From:, so third party registrations are not denied per se by this check).

can_use_address/2

can_use_address(User, URL) -> true | false

Check if a given User may use address Address as From: by using the function can_use_address_detail/2 not caring about the reason it returns.

can_use_address_detail/2

can_use_address_detail(User, URL) -> {Verdict, Reason}

Check if a given User may use address Address as From:

classify_number/2

classify_number(Number, Regexps) -> {ok, Class} | {ok, unknown} | {error, E}

Search a list of regexps until Number matches the Regexp and return the Class.

get_challenge/0

get_challenge() -> Challenge

Create a challenge tuple.

get_nonce/1

get_nonce(Timestamp) -> string()

Create a nonce. Since we have not located any useful randomness functions in Erlang, and since all proxys that share authentication realm should be able to use the responses to the challenges we create here, we use the current time plus the configured sipauth_password.

get_response/5

get_response(Nonce, Method, URIstr, User, Password) -> term()

Equivalent to get_response(Nonce, Method, URIstr, User, Password, realm()).

get_response/6

get_response(Nonce, Method, URIstr, User, Password, Realm) -> Response | none

Get the correct response to a challenge, given a nonce, method, URI, username and password.

get_user_verified/2

get_user_verified(Header, Method) -> false | {stale, User} | {authenticated, User}

Check if there is an Authorization: header in Header and check if it contains a valid response of a challenge we supposedly sent out.

get_user_verified_proxy/2

get_user_verified_proxy(Header, Method) -> false | {stale, User} | {authenticated, User}

throws {siperror, Status, Reason} | {siperror, Status, Reason, ExtraHeaders}

Check if there is an Proxy-Authorization: header in Header and check if it contains a valid response of a challenge we supposedly sent out. Might throw an {siperror, ...} if something is wrong with the authorization header. Notes : XXX we should verify the URI too

is_allowed_pstn_dst/4

is_allowed_pstn_dst(User, ToNumber, Header, Class) -> true | false

Check if a given User is explicitly allowed to call a number in a given Class.

pstn_get_user_verified/2

pstn_get_user_verified(Header, Method) -> false | {stale, User} | {authenticated, User} | {peer_authenticated, User}

throws {siperror, Status, Reason} | {siperror, Status, Reason, ExtraHeaders}

Authenticate through X-YXA-Peer-Auth or, if that does not exist, through Proxy-Authentication.

realm/0

realm() -> string()

Return this proxys configured authentication realm, or the hostname if no realm has been configured.


Generated by EDoc, Oct 17 2007, 16:48:25.