// NewAPIKeyAuthorizer creates an ApiKeyAuthorizer with headers.
546640
func NewAPIKeyAuthorizer(headers map[string]interface{}, queryParameters map[string]interface{}) *APIKeyAuthorizer {
	return &APIKeyAuthorizer{headers: headers, queryParameters: queryParameters}
}
88013
func NewAPIStore(conf *cloudstorage.Config) (*APIStore, error) {
	googleClient, err := NewGoogleClient(conf)
	if err != nil {
		return nil, err
	}
	service, err := storage.New(googleClient.Client())
	if err != nil {
		return nil, err
	}
	return &APIStore{service: service, project: conf.Project}, nil
}
256907
func NewAPIBuilder() *APIBuilder {
	api := &APIBuilder{
		macros:            macro.Defaults,
		errorCodeHandlers: defaultErrorCodeHandlers(),
		reporter:          errors.NewReporter(),
		relativePath:      "/",
		routes:            new(repository),
	}

	return api
}
631197
func NewBasicAuthorizer(userName, password string) *BasicAuthorizer {
	return &BasicAuthorizer{
		userName: userName,
		password: password,
	}
}
1359597
func NewAPIClient(cfg *Configuration) *APIClient {
	if cfg.HTTPClient == nil {
		cfg.HTTPClient = http.DefaultClient
	}

	c := &APIClient{}
	c.cfg = cfg
	c.common.client = c

	// API Services
	c.ConfigApi = (*ConfigApiService)(&c.common)
	c.SearchApi = (*SearchApiService)(&c.common)
	c.ServersApi = (*ServersApiService)(&c.common)
	c.StatsApi = (*StatsApiService)(&c.common)
	c.ZonecryptokeyApi = (*ZonecryptokeyApiService)(&c.common)
	c.ZonemetadataApi = (*ZonemetadataApiService)(&c.common)
	c.ZonesApi = (*ZonesApiService)(&c.common)

	return c
}
901755
func NewApigeeJWTToken(token string, c *http.Client) (JWTToken, error) {

	parsedToken, err := parseToken(token)

	if err != nil {
		return nil, err
	}

	return &ApigeeJWTToken{tokenPayload: *parsedToken, client: c}, nil
}
401923
func NewCredentialAuthority(log logger.Logger, api UserKeyAPIer) *CredentialAuthority {
	return newCredentialAuthorityWithEngine(log, api, newStandardEngine())
}
462477
func NewACLMongoAuthorizer(c *ACLMongoConfig) (Authorizer, error) {
	// Attempt to create new MongoDB session.
	session, err := mgo_session.New(c.MongoConfig)
	if err != nil {
		return nil, err
	}

	authorizer := &aclMongoAuthorizer{
		config:       c,
		session:      session,
		updateTicker: time.NewTicker(c.CacheTTL),
	}

	// Initially fetch the ACL from MongoDB
	if err := authorizer.updateACLCache(); err != nil {
		return nil, err
	}

	go authorizer.continuouslyUpdateACLCache()

	return authorizer, nil
}
418035
func NewBearerAuthorizerCallback(sender Sender, callback BearerAuthorizerCallbackFunc) *BearerAuthorizerCallback {
	if sender == nil {
		sender = &http.Client{Transport: tracing.Transport}
	}
	return &BearerAuthorizerCallback{sender: sender, callback: callback}
}
1160639
func NewAuthMiddlewareHandler(handler http.Handler, auth influxdb.Authorizer) http.Handler {
	return &authMiddlewareHandler{
		handler: handler,
		auth:    auth,
	}
}
1157642
func NewMockAuthorizer(ctrl *gomock.Controller) *MockAuthorizer {
	mock := &MockAuthorizer{ctrl: ctrl}
	mock.recorder = &MockAuthorizerMockRecorder{mock}
	return mock
}
792822
func NewAPIAuthenticator(st *apiprovisioner.State) (AuthenticationProvider, error) {
	stateAddresses, err := st.StateAddresses()
	if err != nil {
		return nil, errors.Trace(err)
	}
	apiAddresses, err := st.APIAddresses()
	if err != nil {
		return nil, errors.Trace(err)
	}
	caCert, err := st.CACert()
	if err != nil {
		return nil, errors.Trace(err)
	}
	modelUUID, err := st.ModelUUID()
	if err != nil {
		return nil, errors.Trace(err)
	}
	stateInfo := &mongo.MongoInfo{
		Info: mongo.Info{
			Addrs:  stateAddresses,
			CACert: caCert,
		},
	}
	apiInfo := &api.Info{
		Addrs:    apiAddresses,
		CACert:   caCert,
		ModelTag: names.NewModelTag(modelUUID),
	}
	return &simpleAuth{stateInfo, apiInfo}, nil
}
1163954
func newBypassAuthorizer(auth kauthorizer.Authorizer, paths ...string) kauthorizer.Authorizer {
	return bypassAuthorizer{paths: sets.NewString(paths...), authorizer: auth}
}
133133
func NewAuthorizer(config *server.Config) (server.Authorizer, error) {
	// @step: load the public certificates
	if err := GetPublicCertificates(); err != nil {
		return nil, err
	}

	// @step: get the identity document for the instance we are running
	document, err := getInstanceIdentityDocument()
	if err != nil {
		return nil, err
	}

	utils.Logger.Info("running node authorizer on instance",
		zap.String("instance-id", document.InstanceID),
		zap.String("region", document.Region))

	// @step: we create a ec2 and autoscaling client
	client := ec2.New(session.New(&aws.Config{
		Region: aws.String(document.Region),
	}))
	asgc := autoscaling.New(session.New(&aws.Config{
		Region: aws.String(document.Region),
	}))

	// @step: get information on the instance we are running
	instance, err := getInstance(client, document.InstanceID)
	if err != nil {
		return nil, err
	}

	return &awsNodeAuthorizer{
		client:   client,
		asgc:     asgc,
		config:   config,
		identity: document,
		instance: instance,
		vpcID:    aws.StringValue(instance.VpcId),
	}, nil
}
492381
func (s *Account) SetApiKeyVersion(v string) *Account {
	s.ApiKeyVersion = &v
	return s
}
5718
func NewAuthorizer(access services.Access, identity services.UserGetter, trust services.Trust) (Authorizer, error) {
	if access == nil {
		return nil, trace.BadParameter("missing parameter access")
	}
	if identity == nil {
		return nil, trace.BadParameter("missing parameter identity")
	}
	if trust == nil {
		return nil, trace.BadParameter("missing parameter trust")
	}
	return &authorizer{access: access, identity: identity, trust: trust}, nil
}
160061
func NewAuthorizeAuthenticator(request authenticator.Request, handler AuthenticationHandler, errorHandler AuthenticationErrorHandler) osinserver.AuthorizeHandler {
	return &authorizeAuthenticator{request: request, handler: handler, errorHandler: errorHandler}
}