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

[FIX] SAML credentialToken removal was preventing mobile from being able to authenticate #14345

Merged
merged 1 commit into from
May 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion app/meteor-accounts-saml/client/saml_client.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { Accounts } from 'meteor/accounts-base';
import { Random } from 'meteor/random';
import { ServiceConfiguration } from 'meteor/service-configuration';

if (!Accounts.saml) {
Expand Down Expand Up @@ -94,12 +95,14 @@ Accounts.saml.initiateLogin = function(options, callback, dimensions) {

Meteor.loginWithSaml = function(options, callback) {
options = options || {};
options.credentialToken = Meteor.default_connection._lastSessionId;
const credentialToken = `id-${ Random.id() }`;
options.credentialToken = credentialToken;

Accounts.saml.initiateLogin(options, function(/* error, result*/) {
Accounts.callLoginMethod({
methodArguments: [{
saml: true,
credentialToken,
}],
userCallback: callback,
});
Expand Down
4 changes: 2 additions & 2 deletions app/meteor-accounts-saml/server/saml_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ Meteor.methods({
});

Accounts.registerLoginHandler(function(loginRequest) {
if (!loginRequest.saml) {
if (!loginRequest.saml || !loginRequest.credentialToken) {
return undefined;
}

const loginResult = Accounts.saml.retrieveCredential(this.connection.id);
const loginResult = Accounts.saml.retrieveCredential(loginRequest.credentialToken);
if (Accounts.saml.settings.debug) {
console.log(`RESULT :${ JSON.stringify(loginResult) }`);
}
Expand Down