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

feat(core): Add SAML login setup #5515

Merged
merged 27 commits into from
Feb 24, 2023

Conversation

flipswitchingmonkey
Copy link
Contributor

Github issue / Community forum post (link here to close automatically):

@flipswitchingmonkey flipswitchingmonkey marked this pull request as draft February 20, 2023 12:45
@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team labels Feb 20, 2023
@flipswitchingmonkey flipswitchingmonkey marked this pull request as ready for review February 23, 2023 12:07
Copy link
Contributor

@krynble krynble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, some minor changes or coments

packages/cli/src/config/schema.ts Outdated Show resolved Hide resolved
packages/cli/src/config/schema.ts Outdated Show resolved Hide resolved
packages/cli/src/config/schema.ts Outdated Show resolved Hide resolved
packages/cli/src/controllers/auth.controller.ts Outdated Show resolved Hide resolved
packages/cli/src/sso/saml/constants.ts Show resolved Hide resolved
* POST /sso/saml/acs
* Assertion Consumer Service endpoint
*/
samlController.post(SamlUrls.acs, async (req: express.Request, res: express.Response) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some providers might redirect using GET so we should also support this method. I think authentik allows you to change to redirect and then it'll be a GET request.

Screenshot 2023-02-23 at 17 22 26

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated and sort of works, but ends with ERR_MISSING_SIG_ALG issue. This may be an authentik setup issue though

packages/cli/src/sso/saml/samlHelpers.ts Outdated Show resolved Hide resolved
Co-authored-by: Omar Ajoue <krynble@gmail.com>
Co-authored-by: Omar Ajoue <krynble@gmail.com>
Co-authored-by: Omar Ajoue <krynble@gmail.com>
| undefined
> {
const attributes = await this.getAttributesFromLoginResponse(req, binding);
if (attributes.email) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe not for this iteration, but if email cannot be find as part of the mapping, we need to warn the user about it.

@@ -190,7 +190,7 @@ export function send<T, R extends Request, S extends Response>(
try {
const data = await processFunction(req, res);

sendSuccessResponse(res, data, raw);
if (!res.headersSent) sendSuccessResponse(res, data, raw);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change necessary since saml-related controllers are not using the annotations?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it's for the default auth /login endpoint to be able to redirect to the initsso endpoint

krynble
krynble previously approved these changes Feb 24, 2023
Copy link
Contributor

@krynble krynble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@flipswitchingmonkey flipswitchingmonkey merged commit 40a934b into master Feb 24, 2023
@flipswitchingmonkey flipswitchingmonkey deleted the pay-155-implement-login-mechanism branch February 24, 2023 19:37
@n8n-assistant n8n-assistant bot added the Upcoming Release Will be part of the upcoming release label Feb 24, 2023
@janober
Copy link
Member

janober commented Feb 27, 2023

Got released with n8n@0.217.2

@janober janober removed the Upcoming Release Will be part of the upcoming release label Feb 27, 2023
sunilrr pushed a commit to fl-g6/qp-n8n that referenced this pull request Apr 24, 2023
* initial commit with sample data

* basic saml setup

* cleanup console logs

* limit saml endpoints through middleware

* basic login and token issue

* saml service and cleanup

* refactor and create user

* get/set saml prefs

* fix authentication issue

* redirect to user details

* merge fix

* add generated password to saml user

* update user from attributes where possible

* refactor and fix creating new user

* rename saml prefs key

* minor cleanup

* Update packages/cli/src/config/schema.ts

Co-authored-by: Omar Ajoue <krynble@gmail.com>

* Update packages/cli/src/config/schema.ts

Co-authored-by: Omar Ajoue <krynble@gmail.com>

* Update packages/cli/src/controllers/auth.controller.ts

Co-authored-by: Omar Ajoue <krynble@gmail.com>

* code review changes

* fix default saml enabled

* remove console.log

* fix isSamlLicensed

---------

Co-authored-by: Omar Ajoue <krynble@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants