mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-05-18 21:46:19 -04:00
Don't check for attributes if no attributes set.
If no attributes are set, the attributes property is nil. This causes a panic if keycloak has no custom attributes. This patch checks for nil before accessing the attributes.
This commit is contained in:
@@ -164,17 +164,20 @@ func (c *ConcreteClient) getToken(ctx context.Context) (*gocloak.JWT, error) {
|
||||
}
|
||||
|
||||
func (c *ConcreteClient) keycloakUserToLibregraph(u *gocloak.User) *libregraph.User {
|
||||
attrs := *u.Attributes
|
||||
ldapID := ""
|
||||
ldapIDs, ok := attrs[_idAttr]
|
||||
if ok {
|
||||
ldapID = ldapIDs[0]
|
||||
}
|
||||
|
||||
var ldapID string
|
||||
var userType *string
|
||||
userTypes, ok := attrs[_userTypeAttr]
|
||||
if ok {
|
||||
userType = &userTypes[0]
|
||||
|
||||
if u.Attributes != nil {
|
||||
attrs := *u.Attributes
|
||||
ldapIDs, ok := attrs[_idAttr]
|
||||
if ok {
|
||||
ldapID = ldapIDs[0]
|
||||
}
|
||||
|
||||
userTypes, ok := attrs[_userTypeAttr]
|
||||
if ok {
|
||||
userType = &userTypes[0]
|
||||
}
|
||||
}
|
||||
|
||||
return &libregraph.User{
|
||||
|
||||
Reference in New Issue
Block a user