added RoleInRoles utility function
This commit is contained in:
		
							
								
								
									
										10
									
								
								keycloakclaims/utils.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								keycloakclaims/utils.go
									
									
									
									
									
										Normal file
									
								
							@@ -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
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user