Skip to content

Commit

Permalink
Merge pull request #192 from ibm-cloud-security/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
TalAviel authored Mar 5, 2021
2 parents 34b723d + ee9ae40 commit 7789d78
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: objective-c
matrix:
include:
- osx_image: xcode10.2
- osx_image: xcode12.3
install:
- gem install jazzy
- gem install slather -v 2.4.5
Expand Down
2 changes: 1 addition & 1 deletion IBMCloudAppID.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "IBMCloudAppID"
s.version = '6.0.2'
s.version = '6.0.3'
s.summary = "AppID Swift SDK"
s.homepage = "https://github.com/ibm-cloud-security/appid-clientsdk-swift"
s.license = 'Apache License, Version 2.0'
Expand Down
11 changes: 10 additions & 1 deletion Source/IBMCloudAppID/internal/Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@ import BMSCore


public class Utils {


public static func base64urlToBase64(base64url: String) -> String {
var base64 = base64url
.replacingOccurrences(of: "-", with: "+")
.replacingOccurrences(of: "_", with: "/")
if base64.count % 4 != 0 {
base64.append(String(repeating: "=", count: 4 - base64.count % 4))
}
return base64
}

public static func JSONStringify(_ value: AnyObject, prettyPrinted:Bool = false) throws -> String{

Expand Down
4 changes: 2 additions & 2 deletions Source/IBMCloudAppID/internal/tokens/AbstractToken.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ internal class AbstractToken: Token {
self.signature = tokenComponents[2]

guard
let headerDecodedData = Utils.decodeBase64WithString(headerComponent, isSafeUrl: true),
let payloadDecodedData = Utils.decodeBase64WithString(payloadComponent, isSafeUrl: true)
let headerDecodedData = Data(base64Encoded: Utils.base64urlToBase64(base64url: headerComponent)),
let payloadDecodedData = Data(base64Encoded: Utils.base64urlToBase64(base64url: payloadComponent))
else {
return nil
}
Expand Down

0 comments on commit 7789d78

Please sign in to comment.