Commit 847ef67c authored by Alexis POYEN's avatar Alexis POYEN
Browse files

Refactor : remove one useless var

parent 97ab3ff8
File added
......@@ -1045,7 +1045,7 @@
"subType" : "authenticated",
"subComponents" : { },
"config" : {
"allowed-protocol-mapper-types" : [ "saml-user-attribute-mapper", "oidc-usermodel-attribute-mapper", "saml-role-list-mapper", "saml-user-property-mapper", "oidc-sha256-pairwise-sub-mapper", "oidc-usermodel-property-mapper", "oidc-full-name-mapper", "oidc-address-mapper" ]
"allowed-protocol-mapper-types" : [ "oidc-full-name-mapper", "saml-user-property-mapper", "oidc-usermodel-property-mapper", "oidc-address-mapper", "saml-user-attribute-mapper", "saml-role-list-mapper", "oidc-sha256-pairwise-sub-mapper", "oidc-usermodel-attribute-mapper" ]
}
}, {
"id" : "657b0eae-2d8f-462d-8192-63cb66f12001",
......@@ -1054,7 +1054,7 @@
"subType" : "anonymous",
"subComponents" : { },
"config" : {
"allowed-protocol-mapper-types" : [ "oidc-sha256-pairwise-sub-mapper", "oidc-usermodel-property-mapper", "oidc-usermodel-attribute-mapper", "saml-user-attribute-mapper", "oidc-full-name-mapper", "saml-role-list-mapper", "saml-user-property-mapper", "oidc-address-mapper" ]
"allowed-protocol-mapper-types" : [ "saml-role-list-mapper", "oidc-address-mapper", "oidc-usermodel-attribute-mapper", "saml-user-property-mapper", "oidc-usermodel-property-mapper", "saml-user-attribute-mapper", "oidc-full-name-mapper", "oidc-sha256-pairwise-sub-mapper" ]
}
}, {
"id" : "a31b57fc-83b8-4c4c-87ef-3395623db84c",
......@@ -1112,7 +1112,7 @@
"internationalizationEnabled" : false,
"supportedLocales" : [ ],
"authenticationFlows" : [ {
"id" : "f41d7ff4-4ba1-4870-b0a8-af01efc8fde6",
"id" : "7f080eb3-1f8a-4ce4-9e0c-5277a4c96713",
"alias" : "Handle Existing Account",
"description" : "Handle what to do if there is existing account with same email/username like authenticated identity provider",
"providerId" : "basic-flow",
......@@ -1138,7 +1138,7 @@
"autheticatorFlow" : true
} ]
}, {
"id" : "83d95585-d168-42c6-b6ce-bd683ba17d6f",
"id" : "496e6a73-802d-4f77-8c4a-786df7e1ffb0",
"alias" : "Verify Existing Account by Re-authentication",
"description" : "Reauthentication of existing account",
"providerId" : "basic-flow",
......@@ -1158,7 +1158,7 @@
"autheticatorFlow" : false
} ]
}, {
"id" : "e4470d32-d622-4e8f-a573-0d5b55b505f7",
"id" : "335fd0ba-46f2-4c5b-bd25-ac000ce4195a",
"alias" : "browser",
"description" : "browser based authentication",
"providerId" : "basic-flow",
......@@ -1190,7 +1190,7 @@
"autheticatorFlow" : true
} ]
}, {
"id" : "3989b224-6b1b-4a9c-a131-cd132d7e91c1",
"id" : "55c8194b-3356-489a-a4d6-22b8e8b653bc",
"alias" : "clients",
"description" : "Base authentication for clients",
"providerId" : "client-flow",
......@@ -1222,7 +1222,7 @@
"autheticatorFlow" : false
} ]
}, {
"id" : "521f01e7-4e32-42f0-b57a-f25d15380365",
"id" : "cb558ac0-8230-4a61-be5a-74d8f7ef3868",
"alias" : "direct grant",
"description" : "OpenID Connect Resource Owner Grant",
"providerId" : "basic-flow",
......@@ -1248,7 +1248,7 @@
"autheticatorFlow" : false
} ]
}, {
"id" : "819586a2-6264-48e9-b671-a5b25426f996",
"id" : "2cc3c265-e61e-408f-8779-3e6deb8e96ab",
"alias" : "docker auth",
"description" : "Used by Docker clients to authenticate against the IDP",
"providerId" : "basic-flow",
......@@ -1262,7 +1262,7 @@
"autheticatorFlow" : false
} ]
}, {
"id" : "871f8164-0823-4f35-9e1e-109501226b59",
"id" : "291ec3f1-86c8-4133-9584-1e3c01dd13fc",
"alias" : "first broker login",
"description" : "Actions taken after first broker login with identity provider account, which is not yet linked to any Keycloak account",
"providerId" : "basic-flow",
......@@ -1290,7 +1290,7 @@
"autheticatorFlow" : true
} ]
}, {
"id" : "d24a3607-cfa8-461b-91a0-57979880d57a",
"id" : "2ffc6ccc-fade-480a-a2be-530943f679e8",
"alias" : "forms",
"description" : "Username, password, otp and other auth forms.",
"providerId" : "basic-flow",
......@@ -1310,7 +1310,7 @@
"autheticatorFlow" : false
} ]
}, {
"id" : "d4ef4971-71d6-4fee-868d-a771b596819b",
"id" : "6ffdeb4e-5a27-483a-8517-9a615a4473f7",
"alias" : "http challenge",
"description" : "An authentication flow based on challenge-response HTTP Authentication Schemes",
"providerId" : "basic-flow",
......@@ -1342,7 +1342,7 @@
"autheticatorFlow" : false
} ]
}, {
"id" : "f3001c75-677d-4ddf-966b-869edf44a3a8",
"id" : "9e95fa16-8570-4b55-bac7-3d3907d14dac",
"alias" : "registration",
"description" : "registration flow",
"providerId" : "basic-flow",
......@@ -1357,7 +1357,7 @@
"autheticatorFlow" : true
} ]
}, {
"id" : "c0f2babc-866f-44fe-9111-c7e56d64286d",
"id" : "9d0e0929-3dbc-43cf-bcac-ec947a7ec689",
"alias" : "registration form",
"description" : "registration form",
"providerId" : "form-flow",
......@@ -1389,7 +1389,7 @@
"autheticatorFlow" : false
} ]
}, {
"id" : "0d612532-6740-4070-8f36-70b5dda9813d",
"id" : "0018cc3d-eb9a-4e2c-8e1d-560e4efef1e7",
"alias" : "reset credentials",
"description" : "Reset credentials for a user if they forgot their password or something",
"providerId" : "basic-flow",
......@@ -1421,7 +1421,7 @@
"autheticatorFlow" : false
} ]
}, {
"id" : "30c5c234-3af7-4ab1-b936-bb0df254f0fc",
"id" : "ff081cb3-b960-4ba8-87f8-06ca6971aa76",
"alias" : "saml ecp",
"description" : "SAML ECP Profile Authentication Flow",
"providerId" : "basic-flow",
......@@ -1436,13 +1436,13 @@
} ]
} ],
"authenticatorConfig" : [ {
"id" : "4040c745-7acb-49ff-80e0-b332f7d2cd5f",
"id" : "6ded914c-d014-496d-bc28-b44630ac4476",
"alias" : "create unique user config",
"config" : {
"require.password.update.after.registration" : "false"
}
}, {
"id" : "e554ecee-9c4d-45ca-a9de-f2500c790d36",
"id" : "e97d91fd-2453-48de-9659-d249dc737621",
"alias" : "review profile config",
"config" : {
"update.profile.on.first.login" : "missing"
......@@ -1516,6 +1516,6 @@
"waitIncrementSeconds" : "60",
"offlineSessionMaxLifespanEnabled" : "false"
},
"keycloakVersion" : "7.0.0",
"keycloakVersion" : "7.0.1",
"userManagedAccessAllowed" : false
}
\ No newline at end of file
......@@ -166,6 +166,7 @@ func getUserInMemory(userOAuth2 UserOAuth2) (User, error) {
func addUserInMemory(userOauth2 UserOAuth2) (User, error) {
var user User
// Define user role or refuse if not in a correct group
for _, userRole := range userOauth2.Roles {
if userRole != "" && (userRole == os.Getenv("ADMIN_GROUP")) {
user.Role = "ADMIN"
......@@ -185,14 +186,13 @@ func addUserInMemory(userOauth2 UserOAuth2) (User, error) {
return user, errors.New("Error on loading user")
}
// Select the new id for the user
maxID := 1
user.ID = 1
for _, val := range users {
if maxID <= val.ID {
maxID = val.ID + 1
if user.ID <= val.ID {
user.ID = val.ID + 1
}
}
user.ID = maxID
// Define user role or refuse if not in a correct group
// Sauvegarder l'utilisateur dans InMemory
users = append(users, user)
sort.Sort(ByID(users))
err = common.Save(UsersFile, &users)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment