Skip to content

Conversation

@Huskydog9988
Copy link
Contributor

Let an ODIC provider sign out users. Also attempted to make the server more spec compliant by verifying responses and enforcing HTTPS for providers by default.

@DecDuck
Copy link
Member

DecDuck commented Jan 4, 2026

Uh, whoops. Literally just heavily modified the session system for MFA. I'll take a look and see what works for both OIDC and MFA.

@Huskydog9988
Copy link
Contributor Author

This is ready to be reviewed now

Copy link
Member

@DecDuck DecDuck left a comment

Choose a reason for hiding this comment

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

Just some nitpick stuff, will have more of a look over when I have a wider screen (I'm on mobile).

@Huskydog9988
Copy link
Contributor Author

Fixed

@DecDuck
Copy link
Member

DecDuck commented Jan 14, 2026

Typecheck is very unhappy

@Huskydog9988
Copy link
Contributor Author

Fixed

});
return { userId: authMek.userId, result };

return { result: true, userId: authMek.userId };
Copy link
Member

Choose a reason for hiding this comment

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

Result needs to be returned, it's a enum containing "fail", "2fa" or "success" - the client uses it to redirect.

import sessionHandler from "../../session";
import type { SessionSearchTerms } from "../../session/types";

// TODO: monitor https://github.com/goauthentik/authentik/issues/8751 for easier?? OIDC setup by end users
Copy link
Member

Choose a reason for hiding this comment

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

Do we know if any self-hosted IDP that has this spec implemented? Would love to have the feature.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No idea tbh

if (!configuration)
throw new Error("OIDC try to init without configuration");

if (systemConfig.shouldOidcRequireHttps()) {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe refactor into an array and a loop to check them all?

issuer: this.oidcConfiguration.issuer.toString(),
});
} catch (e) {
console.error("Failed to verify OIDC logout token:", e);
Copy link
Member

Choose a reason for hiding this comment

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

logger?

}
for (const [key, value] of Object.entries(options.data || {})) {
// stringify to do deep comparison
if (JSON.stringify(session.data[key]) !== JSON.stringify(value)) {
Copy link
Member

Choose a reason for hiding this comment

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

Need to use JSON.stringify(sortMyObj, Object.keys(sortMyObj).sort()) to sort keys to ensure this check works if the objects are modified in different orders.

Alternatively, keep it this way and add comment explaining we don't sort keys because we want the objects to be truly identical.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I need to double check it, but you can't use Object#getKeys on a non object.

// this.sessionProvider = createMemorySessionProvider();
}

// async signin(
Copy link
Member

Choose a reason for hiding this comment

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

Can probably be removed

@DecDuck
Copy link
Member

DecDuck commented Jan 14, 2026

Just reviewed.

Also, does this need a test with the new MFA stuff?

@Huskydog9988
Copy link
Contributor Author

Yea, I don't have the setup to properly test the changes rn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants