//////// Provider functions  /////////////
//////////////////////////////////////////
// NewProvider instantiates a StoreProvider
10853
func NewProvider() Provider {
	dbPath := ledgerconfig.GetPvtdataStorePath()
	dbProvider := leveldbhelper.NewProvider(&leveldbhelper.Conf{DBPath: dbPath})
	return &provider{dbProvider: dbProvider}
}
650205
function getProvider(providerName, providerConfig) {
        return _.extend({}, providerConfig.opts, {
            profile: function profile(credentials, params, get, callback) {
                var proof = null;

                /* eslint camelcase:0 */
                if (providerConfig.useProof) {
                    proof = {
                        appsecret_proof: crypto
                            .createHmac('sha256', this.clientSecret)
                            .update(credentials.token)
                            .digest('hex')
                    };
                }

                get(providerConfig.url, proof, function (data) {
                    credentials.profile = {
                        authType:           providerName,
                        email:              data.email,
                        emailLower:         data.email && data.email.toLowerCase(),
                        emailConfirmed:     data.verified,
                        name: {
                            firstName:      data.given_name || '',
                            lastName:       data.family_name || '',
                            displayName:    data.name || ''
                        }
                    };

                    if (providerName === 'google') {
                        credentials.profile.profileImg = data.picture;
                        credentials.profile.googleAuthData = data;
                    }
                    else if (providerName === 'facebook') {
                        credentials.profile.profileImg = 'https://graph.facebook.com/' +
                            data.id + '/picture?width=80&height=80';
                        credentials.profile.fbAuthData = data;
                    }

                    return callback();
                });
            }
        });
    }
250560
func (f *ProviderFactory) CreateInfraProvider(config fab.EndpointConfig) (fab.InfraProvider, error) {
	return fabpvdr.New(config), nil
}
216432
func newProvider(ak config.AuthKey, ad []byte) (auth.Provider, error) {
	// If no auth key was provided, use unauthenticated
	// requests. This is useful when a local CFSSL is being used.
	if ak.Type == "" && ak.Key == "" {
		return nil, nil
	}

	f, ok := authTypes[ak.Type]
	if !ok {
		return nil, &authError{authType: ak.Type}
	}

	return f(ak, ad)
}
901743
func (m *Module) AddProvider(p *Provider) {
	m.oauthConfigs = append(m.oauthConfigs, p)
}
657772
func NewStoreProvider() StoreProvider {
	dbProvider := leveldbhelper.NewProvider(&leveldbhelper.Conf{DBPath: GetTransientStorePath()})
	return &storeProvider{dbProvider: dbProvider}
}
837732
func NewProvider(providerName string, transport http.RoundTripper, config Config) (external.Provider, error) {
	// TODO: Add support for discovery documents
	// see http://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfig
	// e.g. https://accounts.google.com/.well-known/openid-configuration

	// Validate client id/secret
	if len(config.ClientID) == 0 {
		return nil, errors.New("ClientID is required")
	}
	if len(config.ClientSecret) == 0 {
		return nil, errors.New("ClientSecret is required")
	}

	// Validate url presence
	if len(config.AuthorizeURL) == 0 {
		return nil, errors.New("authorize URL is required")
	} else if u, err := url.Parse(config.AuthorizeURL); err != nil {
		return nil, errors.New("authorize URL is invalid")
	} else if u.Scheme != "https" {
		return nil, errors.New("authorize URL must use https scheme")
	}

	if len(config.TokenURL) == 0 {
		return nil, errors.New("token URL is required")
	} else if u, err := url.Parse(config.TokenURL); err != nil {
		return nil, errors.New("token URL is invalid")
	} else if u.Scheme != "https" {
		return nil, errors.New("token URL must use https scheme")
	}

	if len(config.UserInfoURL) > 0 {
		if u, err := url.Parse(config.UserInfoURL); err != nil {
			return nil, errors.New("UserInfo URL is invalid")
		} else if u.Scheme != "https" {
			return nil, errors.New("UserInfo URL must use https scheme")
		}
	}

	if !sets.NewString(config.Scopes...).Has("openid") {
		return nil, errors.New("scopes must include openid")
	}

	if len(config.IDClaims) == 0 {
		return nil, errors.New("IDClaims must specify at least one claim")
	}

	return provider{providerName: providerName, transport: transport, Config: config}, nil
}
302219
func newInstanceWithProviders(fqc *fqconfig.FilterQueue, mode constants.ModeType, cfg *runtime.Configuration, ipt provider.IptablesProvider, ips provider.IpsetProvider) (*Instance, error) {

	if cfg == nil {
		cfg = &runtime.Configuration{}
	}

	i := &Instance{
		fqc:                     fqc,
		ipt:                     ipt,
		ipset:                   ips,
		appPacketIPTableContext: "mangle",
		netPacketIPTableContext: "mangle",
		appProxyIPTableContext:  "nat",
		mode:                    mode,
		appPacketIPTableSection: ipTableSectionOutput,
		appCgroupIPTableSection: TriremeOutput,
		netLinuxIPTableSection:  TriremeInput,
		netPacketIPTableSection: ipTableSectionInput,
		appSynAckIPTableSection: ipTableSectionOutput,
		contextIDToPortSetMap:   cache.NewCache("contextIDToPortSetMap"),
		createPUPortSet:         ipsetCreatePortset,
		isLegacyKernel:          buildflags.IsLegacyKernel(),
		serviceIDToIPsets:       map[string]*ipsetInfo{},
		puToServiceIDs:          map[string][]string{},
		cfg:                     cfg,
		conntrackCmd:            flushUDPConntrack,
	}

	lock.Lock()
	instance = i
	defer lock.Unlock()

	return i, nil
}
26508
func NewProviderWithID(name string, id *guid.GUID, callback EnableCallback) (provider *Provider, err error) {
	providerCallbackOnce.Do(func() {
		globalProviderCallback = windows.NewCallback(providerCallbackAdapter)
	})

	provider = providers.newProvider()
	defer func(provider *Provider) {
		if err != nil {
			providers.removeProvider(provider)
		}
	}(provider)
	provider.ID = id
	provider.callback = callback

	if err := eventRegister((*windows.GUID)(provider.ID), globalProviderCallback, uintptr(provider.index), &provider.handle); err != nil {
		return nil, err
	}

	metadata := &bytes.Buffer{}
	binary.Write(metadata, binary.LittleEndian, uint16(0)) // Write empty size for buffer (to update later)
	metadata.WriteString(name)
	metadata.WriteByte(0)                                                   // Null terminator for name
	binary.LittleEndian.PutUint16(metadata.Bytes(), uint16(metadata.Len())) // Update the size at the beginning of the buffer
	provider.metadata = metadata.Bytes()

	if err := eventSetInformation(
		provider.handle,
		eventInfoClassProviderSetTraits,
		uintptr(unsafe.Pointer(&provider.metadata[0])),
		uint32(len(provider.metadata))); err != nil {

		return nil, err
	}

	return provider, nil
}
893275
func InitWithProvider(p logger.Provider) error {
	l := logger.New(p)
	l.SetLevel(LvINFO)
	return InitWithLogger(l)
}
610960
func New() *Provider {
	return &Provider{
		params: &scryptParams{
			keyLen:  DefaultKeyLen,
			n:       DefaultN,
			r:       DefaultR,
			p:       DefaultP,
			saltLen: DefaultSaltLen,
		},
	}
}
1041021
function mergeResolvedReflectiveProviders(providers, normalizedProvidersMap) {
    for (var /** @type {?} */ i = 0; i < providers.length; i++) {
        var /** @type {?} */ provider = providers[i];
        var /** @type {?} */ existing = normalizedProvidersMap.get(provider.key.id);
        if (existing) {
            if (provider.multiProvider !== existing.multiProvider) {
                throw new MixingMultiProvidersWithRegularProvidersError(existing, provider);
            }
            if (provider.multiProvider) {
                for (var /** @type {?} */ j = 0; j < provider.resolvedFactories.length; j++) {
                    existing.resolvedFactories.push(provider.resolvedFactories[j]);
                }
            }
            else {
                normalizedProvidersMap.set(provider.key.id, provider);
            }
        }
        else {
            var /** @type {?} */ resolvedProvider = void 0;
            if (provider.multiProvider) {
                resolvedProvider = new ResolvedReflectiveProvider_(provider.key, provider.resolvedFactories.slice(), provider.multiProvider);
            }
            else {
                resolvedProvider = provider;
            }
            normalizedProvidersMap.set(provider.key.id, resolvedProvider);
        }
    }
    return normalizedProvidersMap;
}
881818
function Provider() {
            var _this = this;
            this._providers = [];
            this._exports = [];
            /**
             * Parse Provider name from path
             *
             * @test BootProviderTest
             *
             * @param providerPath
             * @returns {*}
             */
            this.parseNameFromPath = function (providerPath) {
                var fileName = providerPath
                    .split(/[\\/]+/)
                    .pop()
                    .replace(/\.[^/.]+$/, "");
                return fileName;
            };
            /**
             * Initializing Provider object by path
             *
             * @param providerPath
             */
            this.initProvider = function (providerPath, providerName) {
                if (!providerName) {
                    providerName = _this.parseNameFromPath(providerPath);
                }
                var providerSource = require(providerPath);
                var providerObject;
                // TODO
                // Non case sensitive provider key find
                for (var indexSource in providerSource) {
                    // Convert index to lower case
                    var lowerSource = indexSource.toLowerCase();
                    if (indexSource.toLowerCase() === lowerSource) {
                        providerObject = providerSource[indexSource];
                        break;
                    }
                }
                if (!providerObject) {
                    throw new Error("Provider object problem: " + providerPath);
                }
                _this.initProviderObject(providerObject, providerName);
            };
            /**
             * Initializing Provider object by required object
             *
             * @param providesObject
             */
            this.initProviderObject = function (providerObject, providerName) {
                //
                debug("Initializing Provider object: %s", providerName);
                var val = {
                    source: null,
                    instance: null,
                    booted: false,
                    bootedFiles: false,
                    loadedFiles: false,
                    manualBoot: false,
                    exportName: null,
                    exportNamespace: false,
                    //defineNamespace : null,
                    objects: {}
                };
                val.source = providerObject;
                val.instance = typeof val.source === "function" ? new val.source() : val.source;
                _this.validateProviderObject(val.instance);
                val.manualBoot = !!(typeof val.instance.manualBoot === "function" && val.instance.manualBoot() === true);
                val.exportName = val.instance.exportName();
                val.exportNamespace = val.instance.exportNamespace();
                //val.defineNamespace =
                // Call "register" in provider
                val.instance.register();
                debug("Provider register called: %s", providerName);
                if (val.exportName && typeof val.exportName === "string") {
                    // Convert export name to lower case
                    val.exportName = val.exportName.toLowerCase();
                    _this._providers[providerName] = _this._exports[val.exportName] = val;
                }
                else {
                    _this._providers[providerName] = val;
                }
            };
            //
        }
1029104
func NewProvider(name string, callback EnableCallback) (provider *Provider, err error) {
	return NewProviderWithID(name, providerIDFromName(name), callback)
}
1208284
func NewProvider() (ledger.PeerLedgerProvider, error) {
	logger.Info("Initializing ledger provider")
	// Initialize the ID store (inventory of chainIds/ledgerIds)
	idStore := openIDStore(ledgerconfig.GetLedgerProviderPath())
	ledgerStoreProvider := ledgerstorage.NewProvider()
	// Initialize the history database (index for history of values by key)
	historydbProvider := historyleveldb.NewHistoryDBProvider()
	logger.Info("ledger provider Initialized")
	provider := &Provider{idStore, ledgerStoreProvider,
		nil, historydbProvider, nil, nil, nil, nil, nil, nil}
	return provider, nil
}
1176957
func NewProvider(peerID, networkID string, metricsProvider metrics.Provider) *Provider {
	return &Provider{
		PeerID:       peerID,
		NetworkID:    networkID,
		BuildMetrics: NewBuildMetrics(metricsProvider),
	}
}
133736
func New(clientKey, secret, callbackURL string, resources []string, scopes ...string) *Provider {
	p := &Provider{
		ClientKey:    clientKey,
		Secret:       secret,
		CallbackURL:  callbackURL,
		providerName: "azuread",
	}

	p.resources = make([]string, 0, 1+len(resources))
	p.resources = append(p.resources, graphAPIResource)
	p.resources = append(p.resources, resources...)

	p.config = newConfig(p, scopes)
	return p
}