Is there anyway to store the sub directory when the protection space is saved in the NSURLCredential
storage.
Tried
- subclassing
NSURLProtectionSpace
but no result of accessing the property. - 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.
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