Skip to content

Commit

Permalink
Revert "[IMPROVE] Use SessionId for credential token in SAML request (#…
Browse files Browse the repository at this point in the history
…13791)" (#14345)

This reverts commit 3967a74.
  • Loading branch information
geekgonecrazy authored and rodrigok committed May 9, 2019
1 parent 1cdfee7 commit eb35011
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
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

0 comments on commit eb35011

Please sign in to comment.