Skip to content

Commit

Permalink
made keys lowercase for mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
twocanoes committed Nov 9, 2022
1 parent 485be95 commit 7432620
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
46 changes: 23 additions & 23 deletions XCredsLoginPlugIn/LoginWindow/LoginWebViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,17 @@ class LoginWebViewController: WebViewController {

let idTokenInfo = jwtDecode(value: idToken) //dictionary for mappnigs

let mappings = UserDefaults.standard.object(forKey: "mappings")


// username
if let defaultsUsername = defaultsUsername {
username = defaultsUsername
}
else if let idTokenInfo = idTokenInfo, let mappings = mappings as? Dictionary <String,Any>, let mapKey = mappings["username"] as? String, mapKey.count>0, let mapValue = idTokenInfo[mapKey] as? String {
else if let idTokenInfo = idTokenInfo, let mapKey = UserDefaults.standard.object(forKey: "username") as? String, mapKey.count>0, let mapValue = idTokenInfo[mapKey] as? String {
//we have a mapping for username, so use that.

username = mapValue
TCSLogWithMark("username found: \(username)")
TCSLogWithMark("mapped username found: \(username)")

}
else {
Expand Down Expand Up @@ -184,7 +184,7 @@ class LoginWebViewController: WebViewController {
}

//full name
if let idTokenInfo = idTokenInfo, let mappings = mappings as? Dictionary <String,Any>, let mapKey = mappings["fullName"] as? String, mapKey.count>0, let mapValue = idTokenInfo[mapKey] as? String {
if let idTokenInfo = idTokenInfo, let mapKey = UserDefaults.standard.object(forKey: "fullname") as? String, mapKey.count>0, let mapValue = idTokenInfo[mapKey] as? String {
//we have a mapping so use that.
TCSLogWithMark("full name mapped to: \(mapKey)")

Expand All @@ -198,7 +198,7 @@ class LoginWebViewController: WebViewController {
}

//first name
if let idTokenInfo = idTokenInfo, let mappings = mappings as? Dictionary <String,Any>, let mapKey = mappings["firstName"] as? String, mapKey.count>0, let mapValue = idTokenInfo[mapKey] as? String {
if let idTokenInfo = idTokenInfo, let mapKey = UserDefaults.standard.object(forKey: "firstname") as? String, mapKey.count>0, let mapValue = idTokenInfo[mapKey] as? String {
//we have a mapping for username, so use that.
TCSLogWithMark("first name mapped to: \(mapKey)")

Expand All @@ -211,8 +211,8 @@ class LoginWebViewController: WebViewController {
}
//last name

if let idTokenInfo = idTokenInfo, let mappings = mappings as? Dictionary <String,Any>, let mapKey = mappings["lastName"] as? String, mapKey.count>0, let mapValue = idTokenInfo[mapKey] as? String {
//we have a mapping for username, so use that.
if let idTokenInfo = idTokenInfo, let mapKey = UserDefaults.standard.object(forKey: "lastname") as? String, mapKey.count>0, let mapValue = idTokenInfo[mapKey] as? String {
//we have a mapping for lastName, so use that.
TCSLogWithMark("last name mapped to: \(mapKey)")

delegate.setHint(type: .lastName, hint:mapValue)
Expand All @@ -223,26 +223,26 @@ class LoginWebViewController: WebViewController {

}

let isLocal = try? PasswordUtils.isUserLocal(username)
// let isLocal = try? PasswordUtils.isUserLocal(username)

guard let isLocal = isLocal else {
TCSLogWithMark("cannot find if user is local")
delegate.denyLogin()
return
}
//
// if isLocal == false {
// TCSLogWithMark("User is not on system. for now, just abort")
// guard let isLocal = isLocal else {
// TCSLogWithMark("cannot find if user is local")
// delegate.denyLogin()
// return
// }
////
//// if isLocal == false {
//// TCSLogWithMark("User is not on system. for now, just abort")
//// delegate.denyLogin()
//// return
//// }

// let hasHome = try? PasswordUtils.doesUserHomeExist(username)
// guard let hasHome = hasHome else {
// TCSLogWithMark("home dir nil")
// delegate.denyLogin()
// return
// }

let hasHome = try? PasswordUtils.doesUserHomeExist(username)
guard let hasHome = hasHome else {
TCSLogWithMark("home dir nil")
delegate.denyLogin()
return
}

// if hasHome == false {
// TCSLogWithMark("User has no home. for now, just abort")
Expand Down
12 changes: 6 additions & 6 deletions xCreds.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3301;
CURRENT_PROJECT_VERSION = 3302;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = UXP6YEHSPW;
GENERATE_INFOPLIST_FILE = YES;
Expand Down Expand Up @@ -924,7 +924,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3301;
CURRENT_PROJECT_VERSION = 3302;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = UXP6YEHSPW;
GENERATE_INFOPLIST_FILE = YES;
Expand Down Expand Up @@ -983,7 +983,7 @@
CODE_SIGN_ENTITLEMENTS = "XCreds Login Overlay/XCreds_Login_Overlay.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3301;
CURRENT_PROJECT_VERSION = 3302;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
GENERATE_INFOPLIST_FILE = YES;
Expand Down Expand Up @@ -1013,7 +1013,7 @@
CODE_SIGN_ENTITLEMENTS = "XCreds Login Overlay/XCreds_Login_Overlay.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3301;
CURRENT_PROJECT_VERSION = 3302;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
GENERATE_INFOPLIST_FILE = YES;
Expand Down Expand Up @@ -1156,7 +1156,7 @@
CODE_SIGN_ENTITLEMENTS = XCreds/xCreds.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3500;
CURRENT_PROJECT_VERSION = 3302;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
GENERATE_INFOPLIST_FILE = YES;
Expand Down Expand Up @@ -1185,7 +1185,7 @@
CODE_SIGN_ENTITLEMENTS = XCreds/xCreds.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3500;
CURRENT_PROJECT_VERSION = 3302;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
GENERATE_INFOPLIST_FILE = YES;
Expand Down
Binary file not shown.

0 comments on commit 7432620

Please sign in to comment.