goauthentik / goauthentik/authentik

Take the expiration date in LDAP/AD into account

Open
#22,035 0 comments 0 reactions 0 assignees View on GitHub
enhancement enhancement/confirmed
Dominant language
Python
Stars
25.6k
Forks
2k
Avg merge
1d 1h
Merged PRs (30d)
644

Description

### Is your feature request related to a problem?

I would like to use the `accountExpires` attribute from Active Directory to automatically deactivate accounts during synchronization.

### Describe the solution you'd like

It would be nice to have an extension of the standard mapping templates.

### Describe alternatives that you've considered

I tried to create my own mapping rule, but it doesn't work.

```
from datetime import datetime, timezone, timedelta

expires = list_flatten(ldap.get("accountExpires"))
now = datetime.now(timezone.utc)

return {
"is_active": not (expires and expires < now),
"attributes": {
"accountExpires": list_flatten(ldap.get("accountExpires")),
"countryCode": list_flatten(ldap.get("countryCode")),
"notes": list_flatten(ldap.get("description"))
}
}
```

Image

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.