|
@@ -666,6 +666,18 @@ class PassportService {
|
|
|
return missingRequireds;
|
|
return missingRequireds;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Parse Attribute-Based Login Control Rule as Lucene Query
|
|
|
|
|
+ * @param {string} rule Lucene syntax string
|
|
|
|
|
+ * @returns {object} Expression Tree Structure generated by lucene-query-parser
|
|
|
|
|
+ * @see https://github.com/thoward/lucene-query-parser.js/wiki
|
|
|
|
|
+ */
|
|
|
|
|
+ parseABLCRule(rule) {
|
|
|
|
|
+ // parse with lucene-query-parser
|
|
|
|
|
+ // see https://github.com/thoward/lucene-query-parser.js/wiki
|
|
|
|
|
+ return luceneQueryParser.parse(rule);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Verify that a SAML response meets the attribute-base login control rule
|
|
* Verify that a SAML response meets the attribute-base login control rule
|
|
|
*/
|
|
*/
|
|
@@ -675,12 +687,7 @@ class PassportService {
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // parse with lucene-query-parser
|
|
|
|
|
- // see https://github.com/thoward/lucene-query-parser.js/wiki
|
|
|
|
|
- const luceneRule = luceneQueryParser.parse(rule);
|
|
|
|
|
- if (luceneRule == null) {
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ const luceneRule = this.parseABLCRule(rule);
|
|
|
debug({ 'Parsed Rule': JSON.stringify(luceneRule, null, 2) });
|
|
debug({ 'Parsed Rule': JSON.stringify(luceneRule, null, 2) });
|
|
|
|
|
|
|
|
const attributes = this.extractAttributesFromSAMLResponse(response);
|
|
const attributes = this.extractAttributesFromSAMLResponse(response);
|