Convenience functions for use with Cowboy handlers
This module makes it easier to use esaml in your Cowboy-based web application, by providing easy wrappers around the functions in esaml_binding and esaml_sp.custom_security_callback() = fun((#xmlElement{}, esaml:assertion(), custom_security_callback_state()) -> ok | {error, any()})
custom_security_callback_state() = any()
uri() = string()
xml_callback_fun() = fun((#xmlElement{}, xml_callback_state()) -> any())
xml_callback_state() = any()
reply_with_authnreq/4 | Reply to a Cowboy request with an AuthnRequest payload. |
reply_with_authnreq/7 | Reply to a Cowboy request with an AuthnRequest payload and calls the callback with the (signed?) XML. |
reply_with_logoutreq/4 | Reply to a Cowboy request with a LogoutRequest payload. |
reply_with_logoutresp/5 | Reply to a Cowboy request with a LogoutResponse payload. |
reply_with_metadata/2 | Reply to a Cowboy request with a Metadata payload. |
validate_assertion/2 | Validate and parse an Assertion inside a SAMLResponse. |
validate_assertion/3 | |
validate_assertion/5 | Validate and parse an Assertion with duplicate detection. |
validate_logout/2 | Validate and parse a LogoutRequest or LogoutResponse. |
reply_with_authnreq(SP::esaml:sp(), IdPSSOEndpoint::uri(), RelayState::binary(), Req) -> Req
Reply to a Cowboy request with an AuthnRequest payload
RelayState is an arbitrary blob up to 80 bytes long that will be returned verbatim with any assertion that results from this AuthnRequest.reply_with_authnreq(SP::esaml:sp(), IdPSSOEndpoint::uri(), RelayState::binary(), Req, User_Name_Id::undefined | string(), Xml_Callback::undefined | xml_callback_fun(), Xml_Callback_State::undefined | xml_callback_state()) -> Req
Reply to a Cowboy request with an AuthnRequest payload and calls the callback with the (signed?) XML
Similar to reply_with_authnreq/4, but before replying - calls the callback with the (signed?) XML, allowing persistence and later validation.reply_with_logoutreq(SP::esaml:sp(), IdPSLOEndpoint::uri(), NameID::string(), Req) -> Req
Reply to a Cowboy request with a LogoutRequest payload
NameID should be the exact subject name from the assertion you wish to log out.reply_with_logoutresp(SP::esaml:sp(), IdPSLOEndpoint::uri(), Status::esaml:status_code(), RelayState::binary(), Req) -> Req
Reply to a Cowboy request with a LogoutResponse payload
Be sure to keep the RelayState from the original LogoutRequest that you received to allow the IdP to keep state.reply_with_metadata(SP::esaml:sp(), Req) -> Req
Reply to a Cowboy request with a Metadata payload
validate_assertion(SP::esaml:sp(), Req) -> {ok, esaml:assertion(), RelayState::binary(), Req} | {error, Reason::term(), Req}
Validate and parse an Assertion inside a SAMLResponse
This function handles only POST bindings.validate_assertion(SP::esaml:sp(), DuplicateFun::esaml_sp:dupe_fun(), Req) -> {ok, esaml:assertion(), RelayState::binary(), Req} | {error, Reason::term(), Req}
validate_assertion(SP::esaml:sp(), DuplicateFun::esaml_sp:dupe_fun(), Custom_Response_Security_Callback::undefined | custom_security_callback(), Callback_State::undefined | custom_security_callback_state(), Req) -> {ok, esaml:assertion(), RelayState::binary(), Req} | {error, Reason::term(), Req}
Validate and parse an Assertion with duplicate detection
This function handles only POST bindings.
For the signature of DuplicateFun, see esaml_sp:validate_assertion/3validate_logout(SP::esaml:sp(), Req) -> {request, esaml:logoutreq(), RelayState::binary(), Req} | {response, esaml:logoutresp(), RelayState::binary(), Req} | {error, Reason::term(), Req}
Validate and parse a LogoutRequest or LogoutResponse
This function handles both REDIRECT and POST bindings.Generated by EDoc