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)
19498
+
foundOrgInUser := false
19499
+
for _, userOrg := range user.Orgs {
19500
+
if userOrg == org.Id {
19501
+
foundOrgInUser = true
19502
+
break
19503
+
}
19504
+
}
19505
+
19506
+
// check whether user is in org or not
19507
+
foundUserInOrg := false
19508
+
var usr User
19509
+
for _, usr = range org.Users {
19510
+
if usr.Id == user.Id {
19511
+
foundUserInOrg = true
19512
+
break
19513
+
}
19514
+
}
19515
+
19516
+
if (!foundOrgInUser || !foundUserInOrg) && org.SSOConfig.AutoProvision {
19517
+
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)
19518
+
resp.WriteHeader(401)
19519
+
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."}`)))
19520
+
return
19521
+
} else if !foundOrgInUser || !foundUserInOrg {
19522
+
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)
19523
+
if !foundOrgInUser {
19524
+
user.Orgs = append(user.Orgs, org.Id)
19525
+
}
19526
+
if !foundUserInOrg {
19527
+
org.Users = append(org.Users, user)
19528
+
}
19529
+
} else {
19530
+
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)
19640
+
// Checking whether the user is in the org
19641
+
foundOrgInUser := false
19642
+
for _, userOrg := range user.Orgs {
19643
+
if userOrg == org.Id {
19644
+
foundOrgInUser = true
19645
+
break
19646
+
}
19647
+
}
19586
19648
19649
+
// check whether user is in org or not
19650
+
foundUserInOrg := false
19651
+
var usr User
19652
+
for _, usr = range org.Users {
19653
+
if usr.Id == user.Id {
19654
+
foundUserInOrg = true
19655
+
break
19656
+
}
19657
+
}
19658
+
19659
+
if (!foundOrgInUser || !foundUserInOrg) && org.SSOConfig.AutoProvision {
19660
+
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)
19661
+
resp.WriteHeader(401)
19662
+
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."}`)))
19663
+
return
19664
+
} else if !foundOrgInUser || !foundUserInOrg {
19665
+
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)
19666
+
if !foundOrgInUser {
19667
+
user.Orgs = append(user.Orgs, org.Id)
19668
+
}
19669
+
if !foundUserInOrg {
19670
+
org.Users = append(org.Users, user)
19671
+
}
19672
+
} else {
19673
+
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)
19803
+
resp.WriteHeader(401)
19804
+
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."}`)))
19805
+
return
19806
+
}
19807
+
19703
19808
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)
20103
+
foundOrgInUser := false
20104
+
for _, userOrg := range user.Orgs {
20105
+
if userOrg == foundOrg.Id {
20106
+
foundOrgInUser = true
20107
+
break
20108
+
}
20109
+
}
20110
+
20111
+
// check whether user is in org or not
20112
+
foundUserInOrg := false
20113
+
var usr User
20114
+
for _, usr = range foundOrg.Users {
20115
+
if usr.Id == user.Id {
20116
+
foundUserInOrg = true
20117
+
break
20118
+
}
20119
+
}
20120
+
20121
+
if (!foundOrgInUser || !foundUserInOrg) && foundOrg.SSOConfig.AutoProvision {
20122
+
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)
20123
+
resp.WriteHeader(401)
20124
+
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."}`)))
20125
+
return
20126
+
} else if !foundOrgInUser || !foundUserInOrg {
20127
+
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)
20128
+
if !foundOrgInUser {
20129
+
user.Orgs = append(user.Orgs, foundOrg.Id)
20130
+
}
20131
+
if !foundUserInOrg {
20132
+
foundOrg.Users = append(foundOrg.Users, user)
20133
+
}
20134
+
} else {
20135
+
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)
20259
+
20260
+
// Checking whether the user is in the org
20261
+
foundOrgInUser := false
20262
+
for _, userOrg := range user.Orgs {
20263
+
if userOrg == foundOrg.Id {
20264
+
foundOrgInUser = true
20265
+
break
20266
+
}
20267
+
}
20268
+
20269
+
// check whether user is in org or not
20270
+
foundUserInOrg := false
20271
+
var usr User
20272
+
for _, usr = range foundOrg.Users {
20273
+
if usr.Id == user.Id {
20274
+
foundUserInOrg = true
20275
+
break
20276
+
}
20277
+
}
20278
+
20279
+
if (!foundOrgInUser || !foundUserInOrg) && foundOrg.SSOConfig.AutoProvision {
20280
+
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)
20281
+
resp.WriteHeader(401)
20282
+
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."}`)))
20283
+
return
20284
+
} else if !foundOrgInUser || !foundUserInOrg {
20285
+
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)
20286
+
if !foundOrgInUser {
20287
+
user.Orgs = append(user.Orgs, foundOrg.Id)
20288
+
}
20289
+
if !foundUserInOrg {
20290
+
foundOrg.Users = append(foundOrg.Users, user)
20291
+
}
20292
+
} else {
20293
+
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)
20430
+
resp.WriteHeader(401)
20431
+
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."}`)))
20432
+
return
20433
+
}
20434
+
20232
20435
log.Printf("[AUDIT] Adding user %s to org %s (%s) through single sign-on", userName, foundOrg.Name, foundOrg.Id)
0 commit comments