Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PlankaAuthClient #652

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions app/utils/auth/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,3 +400,32 @@
"email": user.email,
"is_admin": is_user_member_of_any_group(user, [GroupType.admin]),
}


class PlankaAuthClient(BaseAuthClient):
"""
An auth client for Planka, a Trello alternative for kanban boards

Docs for OIDC integration:
https://docs.planka.cloud/docs/Configuration/OIDC/
"""

# required in practice, as Planka uses PKCE as well as the client secret
allow_pkce_with_client_secret: bool = True
allowed_scopes: set[ScopeType | str] = {
ScopeType.openid,
ScopeType.profile,
}

@classmethod
def get_userinfo(cls, user: models_core.CoreUser):
return {

Check warning on line 422 in app/utils/auth/providers.py

View check run for this annotation

Codecov / codecov/patch

app/utils/auth/providers.py#L422

Added line #L422 was not covered by tests
"sub": user.id,
"name": get_display_name(
firstname=user.firstname,
name=user.name,
nickname=user.nickname,
),
"groups": [group.name for group in user.groups] + [user.account_type.value],
"email": user.email,
}
Loading