@@ -13,12 +13,13 @@ var HS256_IGNORE_VALIDATION_MESSAGE =
1313 * @constructor
1414 * @memberOf module:auth
1515 *
16- * @param {Object } oauth An instance of @type {OAuthAuthenticator}
17- * @param {Object } options Authenticator options.
18- * @param {String } options.domain AuthenticationClient server domain
19- * @param {String } [options.clientId] Default client ID.
20- * @param {String } [options.clientSecret] Default client Secret.
21- * @param {String } [options.supportedAlgorithms] Algorithms that your application expects to receive
16+ * @param {Object } oauth An instance of @type {OAuthAuthenticator}
17+ * @param {Object } options Authenticator options.
18+ * @param {String } options.domain AuthenticationClient server domain
19+ * @param {String } [options.clientId] Default client ID.
20+ * @param {String } [options.clientSecret] Default client Secret.
21+ * @param {String } [options.supportedAlgorithms] Algorithms that your application expects to receive
22+ * @param {Boolean } [options.__bypassIdTokenValidation] Whether the id_token should be validated or not
2223 */
2324var OAUthWithIDTokenValidation = function ( oauth , options ) {
2425 if ( ! oauth ) {
@@ -34,6 +35,7 @@ var OAUthWithIDTokenValidation = function(oauth, options) {
3435 }
3536
3637 this . oauth = oauth ;
38+ this . __bypassIdTokenValidation = options . __bypassIdTokenValidation ;
3739 this . clientId = options . clientId ;
3840 this . clientSecret = options . clientSecret ;
3941 this . domain = options . domain ;
@@ -56,8 +58,11 @@ var OAUthWithIDTokenValidation = function(oauth, options) {
5658 * @return {Promise|undefined }
5759 */
5860OAUthWithIDTokenValidation . prototype . create = function ( params , data , cb ) {
61+ const _this = this ;
5962 const createAndValidate = this . oauth . create ( params , data ) . then ( r => {
60- var _this = this ;
63+ if ( _this . __bypassIdTokenValidation ) {
64+ return r ;
65+ }
6166 if ( r . id_token ) {
6267 function getKey ( header , callback ) {
6368 if ( header . alg === 'HS256' ) {
0 commit comments