PageSourceSearch

https://auth.centr.com/js/identityProvider/Redirect.js?version=1.62.1

js centr.com collected 2026-10-02 03:09:30 UTC 2,854 bytes, 77 lines download raw bytes

1/*
2 * Copyright (c) 2018-2025, FusionAuth, All Rights Reserved
3 */
4'use strict';
5
6var FusionAuth = FusionAuth || {};
7FusionAuth.IdentityProvider = FusionAuth.IdentityProvider || {};
8
9/**
10 * @constructor
11 */
12FusionAuth.IdentityProvider.Redirect = function() {
13  Prime.Utils.bindAll(this);
14  Prime.Document.addDelegatedEventListener('click', '[data-login-method="UseRedirect"]', this._handleLoginClick);
15
16  // For backwards compatibility add linkedin, openid, and samlv2 if they weren't matched by the data-login-method
17  ['.linkedin', '.openid', '.samlv2'].forEach(function(cls) {
18    var selector = cls + '.login-button';
19    var element = Prime.Document.queryFirst(selector);
20    if (element && !element.is('[data-login-method="UseRedirect"]')) {
21      Prime.Document.addDelegatedEventListener('click', selector, this._handleLoginClick);
22    }
23  }, this);
24};
25
26FusionAuth.IdentityProvider.Redirect.constructor = FusionAuth.IdentityProvider.Redirect;
27FusionAuth.IdentityProvider.Redirect.prototype = {
28
29  /* ===================================================================================================================
30   * Private methods
31   * ===================================================================================================================*/
32
33  _handleLoginClick: function(event, target) {
34    Prime.Utils.stopEvent(event);
35
36    if (FusionAuth.IdentityProvider.InProgress) {
37      FusionAuth.IdentityProvider.InProgress.open();
38    }
39
40    var button = new Prime.Document.Element(target);
41    var identityProviderId = button.getDataAttribute('identityProviderId');
42    var state = FusionAuth.IdentityProvider.Helper.captureState({
43      identityProviderId:  identityProviderId
44    });
45
46    function safeEncode(selector) {
47      var element = document.querySelector(selector);
48      if (element === null) {
49        return '';
50      }
51
52      return encodeURIComponent(element.value);
53    }
54
55    window.location.href = '/oauth2/redirect'
56        + '?client_id=' + Prime.Document.queryFirst('input[name=client_id]').getValue()
57        + '&identityProviderId=' + identityProviderId
58        + '&loginId=' + safeEncode('input[name=loginId]')
59        + '&max_age=' + safeEncode('input[name=max_age]')
60        + '&prompt=' + safeEncode('input[name=prompt]')
61        + '&state=' + state
62        + '&tenantId=' + safeEncode('input[name=tenantId]');
63  }
64};
65
66Prime.Document.onReady(function() {
67  FusionAuth.IdentityProvider.Redirect.instance = new FusionAuth.IdentityProvider.Redirect();
68});
69
70//noinspection DuplicatedCode
71if (document.getElementById('idp_helper') === null) {
72  var element = document.createElement('script');
73  element.id = 'idp_helper';
74  element.src = '/js/identityProvider/Helper.js?version=' + (FusionAuth.Version || '1.11.0');
75  element.async = false;
76  document.getElementsByTagName("head")[0].appendChild(element);
77}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.