Signing into my Gitlab CE installation with my app's login

Viewed 288

I have a nodejs webapp with many users with a custom login process. I would like gitlab to accept that authentication and not force users to create a new app. What is the best way to accomplish this?

2 Answers

I would go for OAuth 2.0 Single Sign On (SSO). Below you can find the architecture diagram taken from here. As you can see the client is redirected to log in in the OAuth2 provider to get a valid token for authentication. The OAuth2 server must be configured for the application requesting access including the secret, the client id and the callback URL.

enter image description here

You can configure GitLab CE to sign in with almost any OAuth2 provider. Only be careful with the limitations:

  • It can only be used for Single Sign on, and will not provide any other access granted by any OAuth provider (importing projects or users, etc)

  • It only supports the Authorization Grant flow (most common for client-server applications, like GitLab)

  • It is not able to fetch user information from more than one URL

  • It has not been tested with user information formats other than JSON

You also need to configure your node js web application as an OAuth2 server. There are npm availables with the source code here.

Recommendation

I would install some open source Identity Management to separate the user management from your webapp, provides better integration with other third parties and forget about encryption and other stuff you need to take care in your webapp. There are multiple options such as KeyCloak for instance.

You have to define a dedicated user , and use the private_token of this user to login for ALL users that will use your application. The restricition would imply all users will have the same rights ....

The other solution is to use the Private Token of the user at login. In this case , only the rights of these particular users will be used.

Related