decaporg / decap-cms

A Git-based CMS for Static Site Generators
https://decapcms.org
MIT License
17.83k stars 3.04k forks source link

Can i change the authentication service in Netlify CMS? #4847

Open konrad-bak opened 3 years ago

konrad-bak commented 3 years ago

Problem: I want to set a different authentication service, than the one provided by repository host. In my case, the repo is on GitLab, while I want to set authentication by Azure accounts - that would have some sort of permissions to login to my Netlify CMS admin, and the Netlify Admin would have permissions to push changes to my GitLab repo.

Is it already possible or is it a feature request? I couldn't find answers myself, almost got to the second page of Google results.

If you know anything - please help

erezrokah commented 3 years ago

Hi @konrad-bak you should be able to do it in a similar approach as in https://www.netlifycms.org/docs/external-oauth-clients/ or by writing your own backend implementation - those can be registered dynamically https://github.com/netlify/netlify-cms/blob/5b4e2ee99f29952c158576336207ba6749f610bc/packages/netlify-cms-app/src/extensions.js#L38

You could extend the current GitLab backend class and replace the authentication component: https://github.com/netlify/netlify-cms/blob/5b4e2ee99f29952c158576336207ba6749f610bc/packages/netlify-cms-backend-gitlab/src/implementation.ts#L106

konrad-bak commented 3 years ago

Hi @konrad-bak you should be able to do it in a similar approach as in https://www.netlifycms.org/docs/external-oauth-clients/ or by writing your own backend implementation - those can be registered dynamically

https://github.com/netlify/netlify-cms/blob/5b4e2ee99f29952c158576336207ba6749f610bc/packages/netlify-cms-app/src/extensions.js#L38

You could extend the current GitLab backend class and replace the authentication component: https://github.com/netlify/netlify-cms/blob/5b4e2ee99f29952c158576336207ba6749f610bc/packages/netlify-cms-backend-gitlab/src/implementation.ts#L106

@erezrokah Thank you for your reply! I still can't quite wrap my head around this, but I'm happy to know that it is doable - Do you know any tutorials that would guide me step-by-step to do that? or some working examples at least?

erezrokah commented 3 years ago

Hi @konrad-bak I'm not familiar with guides/tutorials as this is quite an advanced issue.

I believe you'd need to first create a service similar to git-gateway that has an access token to GitLab and handles users authentication (verify their azure account).