Skip to content

Commit

Permalink
Merge pull request #37 from matsunanaro/fix_session_w_opt_cookie_name
Browse files Browse the repository at this point in the history
fixed issue with optional Session cookieName
  • Loading branch information
bawelter committed Jun 9, 2020
2 parents 9bb4af7 + d4cb949 commit 5bc57e8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ios/Classes/CBManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -282,23 +282,23 @@ class CBManager {
}

func inflateAuthenticator(json: Any?) throws -> Authenticator? {
guard let map = json as? Dictionary<String,String> else {
guard let map = json as? Dictionary<String,Any> else {
return nil
}

switch map["method"] {
switch map["method"] as! String {
case "basic":
guard let username = map["username"], let password = map["password"] else {
guard let username = map["username"] as? String, let password = map["password"] as? String else {
throw CBManagerError.MissingArgument
}

return BasicAuthenticator(username: username, password: password)
case "session":
guard let sessionId = map["sessionId"] else {
guard let sessionId = map["sessionId"] as? String else {
throw CBManagerError.MissingArgument
}

return SessionAuthenticator(sessionID: sessionId, cookieName: map["cookieName"])
return SessionAuthenticator(sessionID: sessionId, cookieName: map["cookieName"] as? String)
default:
throw CBManagerError.IllegalArgument
}
Expand Down

0 comments on commit 5bc57e8

Please sign in to comment.