From 7bdfd541f1812ec0bcc8596f9c250ac7b8315748 Mon Sep 17 00:00:00 2001 From: Darko Luketic Date: Sun, 28 Nov 2021 16:25:58 +0100 Subject: [PATCH] added RoleInRoles utility function --- keycloakclaims/utils.go | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 keycloakclaims/utils.go diff --git a/keycloakclaims/utils.go b/keycloakclaims/utils.go new file mode 100644 index 0000000..1f95c50 --- /dev/null +++ b/keycloakclaims/utils.go @@ -0,0 +1,10 @@ +package keycloakclaims + +func RoleInRoles(role string, claims *Claims) bool { + for _, v := range claims.RealmAccess.Roles { + if role == v { + return true + } + } + return false +}