You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
log.Printf("[AUDIT] Found user %s (%s) which matches SSO info for %s. Redirecting to login!", user.Username, user.Id, userName)
19495
+
foundOrgInUser := false
19496
+
for _, userOrg := range user.Orgs {
19497
+
if userOrg == org.Id {
19498
+
foundOrgInUser = true
19499
+
break
19500
+
}
19501
+
}
19502
+
19503
+
// check whether user is in org or not
19504
+
foundUserInOrg := false
19505
+
var usr User
19506
+
for _, usr = range org.Users {
19507
+
if usr.Id == user.Id {
19508
+
foundUserInOrg = true
19509
+
break
19510
+
}
19511
+
}
19512
+
19513
+
if (!foundOrgInUser || !foundUserInOrg) && org.SSOConfig.AutoProvision {
19514
+
log.Printf("[WARNING] User %s (%s) is not in org %s (%s). Please contact the administrator - (1)", user.Username, user.Id, org.Name, org.Id)
19515
+
resp.WriteHeader(401)
19516
+
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "User not found in the org. Autoprovisioning is disabled. Please contact the admin of the org to allow auto-provisioning of user."}`)))
19517
+
return
19518
+
} else if !foundOrgInUser || !foundUserInOrg {
19519
+
log.Printf("[INFO] User %s (%s) is not in org %s (%s). Auto-provisioning is enabled. Adding user to org - (1)", user.Username, user.Id, org.Name, org.Id)
19520
+
if !foundOrgInUser {
19521
+
user.Orgs = append(user.Orgs, org.Id)
19522
+
}
19523
+
if !foundUserInOrg {
19524
+
org.Users = append(org.Users, user)
19525
+
}
19526
+
} else {
19527
+
log.Printf("[AUDIT] Found user %s (%s) which matches SSO info for %s. Redirecting to login! - (1)", user.Username, user.Id, userName)
log.Printf("[AUDIT] Found user %s (%s) which matches SSO info for %s. Redirecting to login %s!", user.Username, user.Id, userName, redirectUrl)
19637
+
// Checking whether the user is in the org
19638
+
foundOrgInUser := false
19639
+
for _, userOrg := range user.Orgs {
19640
+
if userOrg == org.Id {
19641
+
foundOrgInUser = true
19642
+
break
19643
+
}
19644
+
}
19583
19645
19646
+
// check whether user is in org or not
19647
+
foundUserInOrg := false
19648
+
var usr User
19649
+
for _, usr = range org.Users {
19650
+
if usr.Id == user.Id {
19651
+
foundUserInOrg = true
19652
+
break
19653
+
}
19654
+
}
19655
+
19656
+
if (!foundOrgInUser || !foundUserInOrg) && org.SSOConfig.AutoProvision {
19657
+
log.Printf("[WARNING] User %s (%s) is not in org %s (%s). Please contact the administrator - (2)", user.Username, user.Id, org.Name, org.Id)
19658
+
resp.WriteHeader(401)
19659
+
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "User not found in the org. Autoprovisioning is disabled. Please contact the admin of the org to allow auto-provisioning of user."}`)))
19660
+
return
19661
+
} else if !foundOrgInUser || !foundUserInOrg {
19662
+
log.Printf("[INFO] User %s (%s) is not in org %s (%s). Auto-provisioning is enabled. Adding user to org - (2)", user.Username, user.Id, org.Name, org.Id)
19663
+
if !foundOrgInUser {
19664
+
user.Orgs = append(user.Orgs, org.Id)
19665
+
}
19666
+
if !foundUserInOrg {
19667
+
org.Users = append(org.Users, user)
19668
+
}
19669
+
} else {
19670
+
log.Printf("[AUDIT] Found user %s (%s) which matches SSO info for %s. Redirecting to login!- (2)", user.Username, user.Id, userName)
log.Printf("[INFO] Auto-provisioning user is not allow for org %s (%s) - can not add new user %s - (3)", org.Name, org.Id, userName)
19800
+
resp.WriteHeader(401)
19801
+
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "User not found in the org. Autoprovisioning is disabled. Please contact the admin of the org to allow auto-provisioning of user."}`)))
19802
+
return
19803
+
}
19804
+
19700
19805
log.Printf("[AUDIT] Adding user %s to org %s (%s) through single sign-on", userName, org.Name, org.Id)
log.Printf("[AUDIT] Found user %s (%s) which matches SSO info for %s. Redirecting to login!", user.Username, user.Id, userName)
20100
+
foundOrgInUser := false
20101
+
for _, userOrg := range user.Orgs {
20102
+
if userOrg == foundOrg.Id {
20103
+
foundOrgInUser = true
20104
+
break
20105
+
}
20106
+
}
20107
+
20108
+
// check whether user is in org or not
20109
+
foundUserInOrg := false
20110
+
var usr User
20111
+
for _, usr = range foundOrg.Users {
20112
+
if usr.Id == user.Id {
20113
+
foundUserInOrg = true
20114
+
break
20115
+
}
20116
+
}
20117
+
20118
+
if (!foundOrgInUser || !foundUserInOrg) && foundOrg.SSOConfig.AutoProvision {
20119
+
log.Printf("[WARNING] User %s (%s) is not in org %s (%s). Autoprovisioning of user is disable. Please contact the administrator - (1)", user.Username, user.Id, foundOrg.Name, foundOrg.Id)
20120
+
resp.WriteHeader(401)
20121
+
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "User not found in the org. Autoprovisioning is disabled. Please contact the admin of the org to allow auto-provisioning of user."}`)))
20122
+
return
20123
+
} else if !foundOrgInUser || !foundUserInOrg {
20124
+
log.Printf("[INFO] User %s (%s) is not in org %s (%s). Auto-provisioning is enabled. Adding user to org - (1)", user.Username, user.Id, foundOrg.Name, foundOrg.Id)
20125
+
if !foundOrgInUser {
20126
+
user.Orgs = append(user.Orgs, foundOrg.Id)
20127
+
}
20128
+
if !foundUserInOrg {
20129
+
foundOrg.Users = append(foundOrg.Users, user)
20130
+
}
20131
+
} else {
20132
+
log.Printf("[AUDIT] Found user %s (%s) which matches SSO info for %s. Redirecting to login! - (1)", user.Username, user.Id, userName)
log.Printf("[AUDIT] Found user %s (%s) which matches SSO info for %s. Redirecting to login %s!", user.Username, user.Id, userName, redirectUrl)
20256
+
20257
+
// Checking whether the user is in the org
20258
+
foundOrgInUser := false
20259
+
for _, userOrg := range user.Orgs {
20260
+
if userOrg == foundOrg.Id {
20261
+
foundOrgInUser = true
20262
+
break
20263
+
}
20264
+
}
20265
+
20266
+
// check whether user is in org or not
20267
+
foundUserInOrg := false
20268
+
var usr User
20269
+
for _, usr = range foundOrg.Users {
20270
+
if usr.Id == user.Id {
20271
+
foundUserInOrg = true
20272
+
break
20273
+
}
20274
+
}
20275
+
20276
+
if (!foundOrgInUser || !foundUserInOrg) && foundOrg.SSOConfig.AutoProvision {
20277
+
log.Printf("[WARNING] User %s (%s) is not in org %s (%s). Autoprovisioning user is not allow in org - (2)", user.Username, user.Id, foundOrg.Name, foundOrg.Id)
20278
+
resp.WriteHeader(401)
20279
+
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "User not found in the org. Autoprovisioning is disabled. Please contact the admin of the org to allow auto-provisioning of user."}`)))
20280
+
return
20281
+
} else if !foundOrgInUser || !foundUserInOrg {
20282
+
log.Printf("[INFO] User %s (%s) is not in org %s (%s). Auto-provisioning is enabled. Adding user to org - (2)", user.Username, user.Id, foundOrg.Name, foundOrg.Id)
20283
+
if !foundOrgInUser {
20284
+
user.Orgs = append(user.Orgs, foundOrg.Id)
20285
+
}
20286
+
if !foundUserInOrg {
20287
+
foundOrg.Users = append(foundOrg.Users, user)
20288
+
}
20289
+
} else {
20290
+
log.Printf("[AUDIT] Found user %s (%s) which matches SSO info for %s. Redirecting to login! - (2)", user.Username, user.Id, userName)
log.Printf("[INFO] Auto-provisioning user is not allow for org %s (%s) - can not add new user %s", foundOrg.Name, foundOrg.Id, userName)
20427
+
resp.WriteHeader(401)
20428
+
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "User not found in the org. Autoprovisioning is disabled. Please contact the admin of the org to allow auto-provisioning of user."}`)))
20429
+
return
20430
+
}
20431
+
20229
20432
log.Printf("[AUDIT] Adding user %s to org %s (%s) through single sign-on", userName, foundOrg.Name, foundOrg.Id)
0 commit comments