Skip to content
This repository has been archived by the owner on Nov 16, 2020. It is now read-only.

Commit

Permalink
Fix spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
cardoso committed Jul 20, 2017
1 parent 9f6608b commit f53b922
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions Sources/Authentication/Header/Basic.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ extension AuthorizationHeader {
guard let range = string.range(of: "Basic ") else {
return nil
}

let token = string.substring(from: range.upperBound)

let decodedToken = token.makeBytes().base64Decoded.makeString()
guard let separatorRange = decodedToken.range(of: ":") else {
return nil
}

let username = decodedToken.substring(to: separatorRange.lowerBound)
let password = decodedToken.substring(from: separatorRange.upperBound)

return Password(username: username, password: password)
}

public init(basic: Password) {
let credentials = "\(basic.username):\(basic.password)"
let encoded = credentials.makeBytes().base64Encoded.makeString()
Expand Down
4 changes: 2 additions & 2 deletions Sources/Authentication/Header/Bearer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ extension AuthorizationHeader {
guard let range = string.range(of: "Bearer ") else {
return nil
}

let token = string.substring(from: range.upperBound)
return Token(string: token)
}

public init(bearer: Token) {
self.init(string: "Bearer \(bearer.string)")
}
Expand Down

0 comments on commit f53b922

Please sign in to comment.