{"action":"created","issue":{"url":"https://api.github.com/repos/Alamofire/Alamofire/issues/537","labels_url":"https://api.github.com/repos/Alamofire/Alamofire/issues/537/labels{/name}","comments_url":"https://api.github.com/repos/Alamofire/Alamofire/issues/537/comments","events_url":"https://api.github.com/repos/Alamofire/Alamofire/issues/537/events","html_url":"https://github.com/Alamofire/Alamofire/issues/537","id":89412990,"number":537,"title":"Allow NSURLCredential persistence to be specified","user":{"login":"jessecurry","id":132399,"avatar_url":"https://avatars.githubusercontent.com/u/132399?v=3","gravatar_id":"","url":"https://api.github.com/users/jessecurry","html_url":"https://github.com/jessecurry","followers_url":"https://api.github.com/users/jessecurry/followers","following_url":"https://api.github.com/users/jessecurry/following{/other_user}","gists_url":"https://api.github.com/users/jessecurry/gists{/gist_id}","starred_url":"https://api.github.com/users/jessecurry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jessecurry/subscriptions","organizations_url":"https://api.github.com/users/jessecurry/orgs","repos_url":"https://api.github.com/users/jessecurry/repos","events_url":"https://api.github.com/users/jessecurry/events{/privacy}","received_events_url":"https://api.github.com/users/jessecurry/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Alamofire/Alamofire/labels/enhancement","name":"enhancement","color":"2D8DFF"},{"url":"https://api.github.com/repos/Alamofire/Alamofire/labels/security","name":"security","color":"69B805"}],"state":"closed","locked":false,"assignee":{"login":"cnoon","id":169110,"avatar_url":"https://avatars.githubusercontent.com/u/169110?v=3","gravatar_id":"","url":"https://api.github.com/users/cnoon","html_url":"https://github.com/cnoon","followers_url":"https://api.github.com/users/cnoon/followers","following_url":"https://api.github.com/users/cnoon/following{/other_user}","gists_url":"https://api.github.com/users/cnoon/gists{/gist_id}","starred_url":"https://api.github.com/users/cnoon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cnoon/subscriptions","organizations_url":"https://api.github.com/users/cnoon/orgs","repos_url":"https://api.github.com/users/cnoon/repos","events_url":"https://api.github.com/users/cnoon/events{/privacy}","received_events_url":"https://api.github.com/users/cnoon/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/Alamofire/Alamofire/milestones/3","html_url":"https://github.com/Alamofire/Alamofire/milestones/1.3.0","labels_url":"https://api.github.com/repos/Alamofire/Alamofire/milestones/3/labels","id":1096240,"number":3,"title":"1.3.0","description":"- [ ] TLS Evaluation / Certificate Pinning\r\n- [ ] Multipart Form Data Uploads\r\n- [ ] Download Resume Data Support","creator":{"login":"cnoon","id":169110,"avatar_url":"https://avatars.githubusercontent.com/u/169110?v=3","gravatar_id":"","url":"https://api.github.com/users/cnoon","html_url":"https://github.com/cnoon","followers_url":"https://api.github.com/users/cnoon/followers","following_url":"https://api.github.com/users/cnoon/following{/other_user}","gists_url":"https://api.github.com/users/cnoon/gists{/gist_id}","starred_url":"https://api.github.com/users/cnoon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cnoon/subscriptions","organizations_url":"https://api.github.com/users/cnoon/orgs","repos_url":"https://api.github.com/users/cnoon/repos","events_url":"https://api.github.com/users/cnoon/events{/privacy}","received_events_url":"https://api.github.com/users/cnoon/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":4,"state":"open","created_at":"2015-05-05T04:51:36Z","updated_at":"2015-06-22T01:32:00Z","due_on":"2015-07-13T07:00:00Z","closed_at":null},"comments":1,"created_at":"2015-06-18T22:31:22Z","updated_at":"2015-06-22T01:32:00Z","closed_at":"2015-06-22T01:32:00Z","body":"There's currently no clear way to reset the current session preventing logout for web services that use basic auth and session storage.\r\n\r\n```\r\n    public func authenticate(#user: String, password: String) -> Self {\r\n        let credential = NSURLCredential(user: user, password: password, persistence: .ForSession)\r\n\r\n        return authenticate(usingCredential: credential)\r\n    }\r\n```\r\n\r\nI'd propose adding a `persistence` parameter to the `authenticate` method or adding a method to the `Manager` to clear the current session."},"comment":{"url":"https://api.github.com/repos/Alamofire/Alamofire/issues/comments/113979073","html_url":"https://github.com/Alamofire/Alamofire/issues/537#issuecomment-113979073","issue_url":"https://api.github.com/repos/Alamofire/Alamofire/issues/537","id":113979073,"user":{"login":"cnoon","id":169110,"avatar_url":"https://avatars.githubusercontent.com/u/169110?v=3","gravatar_id":"","url":"https://api.github.com/users/cnoon","html_url":"https://github.com/cnoon","followers_url":"https://api.github.com/users/cnoon/followers","following_url":"https://api.github.com/users/cnoon/following{/other_user}","gists_url":"https://api.github.com/users/cnoon/gists{/gist_id}","starred_url":"https://api.github.com/users/cnoon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cnoon/subscriptions","organizations_url":"https://api.github.com/users/cnoon/orgs","repos_url":"https://api.github.com/users/cnoon/repos","events_url":"https://api.github.com/users/cnoon/events{/privacy}","received_events_url":"https://api.github.com/users/cnoon/received_events","type":"User","site_admin":false},"created_at":"2015-06-22T01:32:00Z","updated_at":"2015-06-22T01:32:00Z","body":"Hi @jessecurry, thank you for your feedback.\r\n\r\nThere is a way to reset the credential, but it is pretty hidden. You could get the credential storage and remove the credential like so:\r\n\r\n```swift\r\nlet manager = Alamofire.Manager.sharedInstance\r\nif let storage = manager.session.configuration.URLCredentialStorage {\r\n    storage.removeCredential(credential: credential, forProtectionSpace: protectionSpace)\r\n}\r\n```\r\n\r\nHowever, since this would be brutal to have to do each time and still utilize the convenience of the `authenticate` method, I think your proposal for exposing the `persistence` parameter is valid. \r\n\r\nI have incorporated your suggestion into cb9e11b9 and set the default value to `.ForSession`. Thus, the change is backwards compatible and still has the same default behavior as before.\r\n\r\nCheers 🍻"}}