Skip to content

Authorization Methods

Danilo edited this page Jun 15, 2020 · 2 revisions

Overview

The authorizationMethod property allows to set the authentication in the header of the request or in the header of SOAP message.

Samples

Basic Authentication in the header of request (@wikipedia) :
SOAPEngine *soap = [[SOAPEngine alloc] init];
    
soap.authorizationMethod = SOAP_AUTH_BASIC;
soap.username = @"my-username";
soap.password = @"my-password";

result like below :

Authorization: Basic bXktdXNl....tcGFzc3dvcmQ=
Basic Authentication in the header of SOAP message :
soap.authorizationMethod = SOAP_AUTH_BASICAUTH;
soap.username = @"my-username";
soap.password = @"my-password";

result like below :

<soap:Header>
	<auth:BasicAuth soap:mustUnderstand="1">
		<Name>my-username</Name>
		<Password>my-password</Password>
	</auth:BasicAuth>
</soap:Header>
Digest Authentication in the header of request :
soap.authorizationMethod = SOAP_AUTH_DIGEST;
soap.username = @"my-username";
soap.password = @"my-password";
soap.realm = @"my-realm";

result like below :

Authorization: Basic bXktdXNl....tcGFzc3dvcmQ=
Token Authentication :
soap.authorizationMethod = SOAP_AUTH_TOKEN;
soap.token = @"bXktdXNl....tcGFzc3dvcmQ=";

result like below :

Authorization: Bearer bXktdXNl....tcGFzc3dvcmQ=
Web Services Security [WS-Security, WSS] (@wikipedia) :
soap.authorizationMethod = SOAP_AUTH_WSSECURITY;
soap.username = @"my-username";
soap.password = @"my-password";

result like below :

<soap:Header>
	<wsse:Security>
	<wsse:UsernameToken wsu:Id="Id-3D5B421468884DBBB9D19B992C2898DE">
		<wsse:Username>my-username</wsse:Username>
		<wsse:Password Type="#PasswordDigest">i4Fv94UsKt9AbU7kiKgNYVxrVVo=</wsse:Password>
		<wsse:Nonce EncodingType="#Base64Binary">QjlEMTlCOTkyQzI4OThERQ==</wsse:Nonce>
		<wsu:Created>2020-06-15T21:01:08.390Z</wsu:Created>
	</wsse:UsernameToken></wsse:Security>
</soap:Header>
Web Services Security [WS-Security, WSS] with text password (@wikipedia) :
soap.authorizationMethod = SOAP_AUTH_WSSECURITY_TEXT;
soap.username = @"my-username";
soap.password = @"my-password";

result like below :

<soap:Header>
	<wsse:Security>
		<wsse:UsernameToken wsu:Id="Id-E95BF39A839C4369971D053CD04EE65E">
		<wsse:Username>my-username</wsse:Username>
		<wsse:Password Type="#PasswordText">my-password</wsse:Password>
		<wsse:Nonce EncodingType="#Base64Binary">OTcxRDA1M0NEMDRFRTY1RQ==</wsse:Nonce>
		<wsu:Created>2020-06-15T21:04:50.306Z</wsu:Created>
	</wsse:UsernameToken>
</wsse:Security></soap:Header>
Custom Authentication :
    soap.authorizationMethod = SOAP_AUTH_CUSTOM;
    soap.header = @{
        @"username" : @{
            @"value" : @"my-password",
            @"attributes": @{ @"xmlns:": @"http://my-namespace" }
        }, @"password" : @"my-password"
    };

result like below :

<soap:Header>
	<username xmlns:="http://my-namespace">my-password</username>
	<password>my-password</password>
</soap:Header>
PayPal Authentication :

Please, look the PayPal example

Social Authentication :

no longer available.

Clone this wiki locally