Vikunja에 Authentik을 이용한 SSO 로그인 적용하기.
안녕하세요. 달소입니다.
이번에는 앞서 구축한 Trello 의 대안인 Vikunja에 SSO 인증을 붙여서 로컬 로그인을 사용하지 않고
기존 구축한 Authentik 을 이용해서 진행해보겠습니다.
글을 거의다 썼다가 캡쳐본까지 날려서,, 공식가이드도 많이첨부합니다.
사전 준비사항
사전정의내용은 아래와같습니다.
vik.companyVikunja의 FQDN입니다.
authentik.companyAuthentik의 FQDN입니다.
authentik Login - config.yml에 설정된 Vikunja에 표시되는 이름이며 리디렉션 URI에 사용됩니다. config.yml에 설정된 이름에 이 예제와 같이 대문자나 공백이 있으면 소문자로 설정되고 콜백 URL에는 공백이 없습니다 authentiklogin.
Authentik 설정 셋팅하기
Provider 생성부터진행합니다. OAuth2/OpenID
클라이언트 ID와 Secret도 기억해주세요.
그리고 사용할 Application도 생성해주세요.
이제 위 클라이언트 ID / Secret를 가지고 Vikunja 설정값을 변경해주겠습니다.
Vikunja 설정변경하기
먼저 Authentik을 붙이기 위해서는 config 파일을 추가로 생성하고 볼륨매핑을 해야합니다.
mkdir config
vi config/config.yml
다른내용은 안넣고 아래 내용에서 auth url, Client id/secret만 수정해주시면됩니다.
auth:
# Local authentication will let users log in and register (if enabled) through the db.
# This is the default auth mechanism and does not require any additional configuration.
local:
# Enable or disable local authentication
enabled: false
# OpenID configuration will allow users to authenticate through a third-party OpenID Connect compatible provider.<br/>
# The provider needs to support the `openid`, `profile` and `email` scopes.<br/>
# **Note:** Some openid providers (like gitlab) only make the email of the user available through openid claims if they have set it to be publicly visible.
# If the email is not public in those cases, authenticating will fail.
# **Note 2:** The frontend expects to be redirected after authentication by the third party
# to <frontend-url>/auth/openid/<auth key>. Please make sure to configure the redirect url with your third party
# auth service accordingly if you're using the default vikunja frontend.
# Take a look at the [default config file](https://kolaente.dev/vikunja/api/src/branch/main/config.yml.sample) for more information about how to configure openid authentication.
openid:
# Enable or disable OpenID Connect authentication
enabled: true
# The url to redirect clients to. Defaults to the configured frontend url. If you're using Vikunja with the official
# frontend, you don't need to change this value.
# **Note:** The redirect url must exactly match the configured redirect url with the third party provider.
# This includes all slashes at the end or protocols.
# A list of enabled providers
providers:
# The name of the provider as it will appear in the frontend.
- name: authentiklogin
# The auth url to send users to if they want to authenticate using OpenID Connect.
authurl: https://auth.dalso.org/application/o/vikunja/
# The oidc logouturl that users will be redirected to on logout.
# Leave empty or delete key, if you do not want to be redirected.
logouturl:
# The client ID used to authenticate Vikunja at the OpenID Connect provider.
clientid: <clientid>
# The client secret used to authenticate Vikunja at the OpenID Connect provider.
clientsecret: <clientsecret>
이렇게 하고 컨테이너들을 재시작시켜주면 아래처럼 로그인 페이지가 변경됩니다~
끝..! Todo 잘쓰고잇습니다 ㅎ
ㅇㄹㅇㄹ