mirror of
https://github.com/wekan/wekan.git
synced 2026-11-26 20:45:07 -05:00
SAML 2.0 lets an identity provider sign the Response, the Assertion or both. WeKan always required a signed Response (node-saml's default, never overridden), so an identity provider that signs only the Assertion was rejected with "Invalid document signature" before the Assertion was checked. Admin Panel -> People -> SAML now has SAML_IDP_PROFILE: standard, which keeps the previous behaviour, or signed-assertion-redirect, which requires the Assertion signature instead and logs in by full-page redirect. SAML_WANT_RESPONSE_SIGNED, SAML_WANT_ASSERTIONS_SIGNED and SAML_LOGIN_FLOW can each be set on their own; left at Default they follow the profile. A configuration requiring neither signature is refused, and validation errors now reach the administrator instead of "Internal server error". In redirect mode the ACS stores the validated profile under the random credential token and redirects to /sign-in?samlToken=; the page exchanges it and opens /. The assertion never enters the address. The token is remembered in the tab that started the login, and a samlToken that tab did not start is not exchanged, so a link cannot sign a browser into another account. Errors return as samlError and are shown on the sign-in page. A test signs responses with a throwaway key and runs them through the shipped node-saml; browser tests log in through the fixture identity provider in both flows. The new message is English, pending Transifex. Thanks to xet7 !
58 lines
2.5 KiB
JavaScript
58 lines
2.5 KiB
JavaScript
import { Meteor } from 'meteor/meteor';
|
|
import { Template } from 'meteor/templating';
|
|
import { ReactiveVar } from 'meteor/reactive-var';
|
|
import { TAPi18n } from '/imports/i18n';
|
|
import './authProviderSettings.jade';
|
|
|
|
Template.authProviderSettings.onCreated(function () {
|
|
this.loaded = new ReactiveVar(false);
|
|
this.busy = new ReactiveVar(false);
|
|
this.error = new ReactiveVar('');
|
|
this.config = new ReactiveVar({});
|
|
this.refresh = () => Meteor.call(this.data.loadMethod, (error, result) => {
|
|
if (error) this.error.set(error.reason || TAPi18n.__('error'));
|
|
else { this.config.set(result); this.loaded.set(true); }
|
|
});
|
|
this.refresh();
|
|
});
|
|
Template.authProviderSettings.helpers({
|
|
loaded() { return Template.instance().loaded; },
|
|
busy() { return Template.instance().busy; },
|
|
error() { return Template.instance().error; },
|
|
fields() {
|
|
const { overrides = {}, sources = {} } = Template.instance().config.get();
|
|
return this.fields.map(field => {
|
|
const value = overrides[field.key];
|
|
const source = sources[field.key] || {};
|
|
return { ...field, value: value ?? '', effective: String(source.value ?? ''),
|
|
booleanField: field.type === 'boolean', multiline: field.type === 'textarea',
|
|
choiceField: field.type === 'choice',
|
|
choiceOptions: (field.choices || []).map(choice => ({ value: choice, selected: value === choice })),
|
|
inherit: value === undefined, enabled: value === true, disabled: value === false,
|
|
sourceLabel: source.source === 'admin' ? TAPi18n.__('admin-panel')
|
|
: source.source === 'env' ? field.envVar
|
|
// SAML fields left at Default follow the identity-provider profile.
|
|
: source.source === 'profile' ? 'SAML_IDP_PROFILE' : TAPi18n.__('default') };
|
|
});
|
|
},
|
|
urls() { return Object.values(Template.instance().config.get().urls || {}).map(url => ({ url })); },
|
|
});
|
|
Template.authProviderSettings.events({
|
|
'submit .js-auth-provider-settings'(event, instance) {
|
|
event.preventDefault();
|
|
if (instance.busy.get()) return;
|
|
const input = {};
|
|
for (const field of instance.findAll('.js-auth-config-field')) {
|
|
input[field.dataset.key] = field.dataset.boolean && field.value !== ''
|
|
? field.value === 'true' : field.value;
|
|
}
|
|
instance.busy.set(true);
|
|
instance.error.set('');
|
|
Meteor.call(instance.data.saveMethod, input, error => {
|
|
instance.busy.set(false);
|
|
if (error) instance.error.set(error.reason || TAPi18n.__('error'));
|
|
else instance.refresh();
|
|
});
|
|
},
|
|
});
|