NSURLProtectionSpace - Handling sub directories in the same host

89 views Asked by At

Is there anyway to store the sub directory when the protection space is saved in the NSURLCredential storage.

Tried

  1. subclassing NSURLProtectionSpace but no result of accessing the property.
  2. adding the postfix to the host property and retrieving the domain by splitting the string of the host. but this results in duplicating same protection space in NSURLCredentialStorage; one for the host with postfix and one for the host without postfix

The requirement is to have separate protection space for two virtual domains under the same host.

Ex: http://example.com/vdomain1 and http://example.com/vdomain2

need to check the domain when looking for the credentials for the particular.

Thanks in advance.

1

There are 1 answers

0
Dhammini F. On

For anyone has the same issue, here's the solution.

You could use realm property in NSURLProtectionSpace for this purpose.

Reference: https://serverfault.com/questions/67979/what-is-the-technical-definition-of-a-realm