Skip to main content

Authentication

We use Keycloak as our identity and access management system. Moreover, we use OAuth2-proxy to authenticate users with Keycloak in any deployed service.

The login is requested automatically when a service is protected by OAuth2-proxy. The user is redirected to the Keycloak login page, where they can enter their credentials. After successful authentication, the user is redirected back to the service.

Protect a service​

Add the following lines to the Ingress:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
nginx.ingress.kubernetes.io/auth-url: https://oauth2.agrospai.udl.cat/oauth2/auth
nginx.ingress.kubernetes.io/auth-signin: https://oauth2.agrospai.udl.cat/oauth2/start?rd=$scheme://$best_http_host$request_uri
nginx.ingress.kubernetes.io/proxy-buffer-size: '16k'
nginx.ingress.kubernetes.io/auth-response-headers: 'x-auth-request-user, x-auth-request-email, x-auth-request-access-token'

Add a new user​

Add a new user in the apps-deploy repository following the already existing users. For more information, check the Crossplane provider documentation.

You need to provide the GitHub userId, which can be obtained from the GitHub API as follows:

USER=username
curl -s https://api.github.com/users/$USER | jq -r '.id'

You can check this example for the rosagil user.

Logout from all services​

Currently is not possible to logout from a single service. To logout from all services, navigate to the Logout Page.

Use manual login​

Harbor​

Go to /account/sign-in.