// IsAuthorizedRequestor returns true if the caller belongs to 'requestor' set
// of at least one rule.
344673
func (r *Rules) IsAuthorizedRequestor(c context.Context, id identity.Identity) (bool, error) {
	return r.requestors.IsMember(c, id)
}
410000
func IsUnauthorizedError(err error) (bool, error) {
	e, ok := errs.Cause(err).(UnauthorizedError)
	if !ok {
		return false, nil
	}
	return true, e
}
403709
func Authorized() runtime.Authorizer {
	return runtime.AuthorizerFunc(func(_ *http.Request, _ interface{}) error { return nil })
}
1327800
func isAuthorizedCall(c context.Context, s *Settings) (bool, error) {
	// Someone from an admin group (if it is configured)? This is useful locally
	// during development.
	if s.AdministratorsGroup != "" {
		switch yep, err := auth.IsMember(c, s.AdministratorsGroup); {
		case err != nil:
			return false, err
		case yep:
			return true, nil
		}
	}

	// The config server itself (if it is configured)? May be empty when
	// running stuff locally.
	if s.ConfigServiceHost != "" {
		info, err := signing.FetchServiceInfoFromLUCIService(c, "https://"+s.ConfigServiceHost)
		if err != nil {
			return false, err
		}
		caller := auth.CurrentIdentity(c)
		if caller.Kind() == identity.User && caller.Value() == info.ServiceAccountName {
			return true, nil
		}
	}

	// A total stranger.
	return false, nil
}
1273625
func IsAllowed(ctx context.Context, p influxdb.Permission) error {
	a, err := influxdbcontext.GetAuthorizer(ctx)
	if err != nil {
		return err
	}

	if !a.Allowed(p) {
		return &influxdb.Error{
			Code: influxdb.EUnauthorized,
			Msg:  fmt.Sprintf("%s is unauthorized", p),
		}
	}

	return nil
}
1116976
func (sa *StorageAuthority) CountInvalidAuthorizations(ctx context.Context, req *sapb.CountInvalidAuthorizationsRequest) (count *sapb.Count, err error) {
	return &sapb.Count{}, nil
}
372308
func IsUnauthorizedError(err error) bool {
	if err == nil {
		return false
	}

	if apiErr, ok := err.(*Error); ok {
		return apiErr.Type == UnauthorizedError
	}

	return false
}
1208752
func IsErrUnauthorized(err error) bool {
	if _, ok := err.(unauthorizedError); ok {
		return ok
	}
	return errdefs.IsUnauthorized(err)
}
614177
func (r *claimResolver) Verifier(iss string) (*oidc.IDTokenVerifier, error) {
	r.m.Lock()
	av := r.verifierPerIssuer[iss]
	if av == nil {
		// This lazy init should normally be very quick.
		// TODO: Make this context cancelable.
		ctx := oidc.ClientContext(context.Background(), r.client)
		av = newAsyncIDTokenVerifier(ctx, r.config, iss)
		r.verifierPerIssuer[iss] = av
	}
	r.m.Unlock()

	v := av.verifier()
	if v == nil {
		return nil, fmt.Errorf("verifier not initialized for issuer: %q", iss)
	}
	return v, nil
}
79043
func (r Account_Internal_Ibm) HasExistingRequest(employeeUid *string, managerUid *string) (resp bool, err error) {
	params := []interface{}{
		employeeUid,
		managerUid,
	}
	err = r.Session.DoRequest("SoftLayer_Account_Internal_Ibm", "hasExistingRequest", params, &r.Options, &resp)
	return
}
611496
func (this *Request) IsValid(rw http.ResponseWriter, req *http.Request) bool {
	if !this.checkSignature(req) {
		rw.WriteHeader(http.StatusUnauthorized)
		rw.Write([]byte(http.StatusText(http.StatusUnauthorized)))
		return false
	}
	if req.Method != "POST" {
		rw.WriteHeader(http.StatusOK)
		rw.Write([]byte(req.FormValue("echostr")))
		return false
	}
	if err := this.parseRequest(req); err != nil {
		rw.WriteHeader(http.StatusBadRequest)
		rw.Write([]byte(err.Error()))
		return false
	}
	return true
}
631197
func NewBasicAuthorizer(userName, password string) *BasicAuthorizer {
	return &BasicAuthorizer{
		userName: userName,
		password: password,
	}
}
617640
func IsAuthorisationFailure(err error) bool {
	// This should cover most cases.
	if gomaasapi.IsPermissionError(err) {
		return true
	}

	// This should cover exceptional circumstances.
	if maasErr, ok := err.(gomaasapi.ServerError); ok {
		return common.AuthorisationFailureStatusCodes.Contains(maasErr.StatusCode)
	}
	return false
}
1195281
func IsAuthorisationFailure(err error) bool {
	if err == nil {
		return false
	}

	serviceError, ok := err.(ociCommon.ServiceError)
	if !ok {
		// Just to double check, also try the SDK's
		// implementation. This isn't checked first, because
		// it is hard to test.
		serviceError, ok = ociCommon.IsServiceError(err)
	}

	if ok && authErrorCodes.Contains(serviceError.GetCode()) {
		return true
	}

	return false
}
1107717
func hasAuthorizedRole(sourceRole, providedRole string) bool {
	switch sourceRole {
	case ViewerRoleName:
		switch providedRole {
		case ViewerRoleName, EditorRoleName, AdminRoleName:
			return true
		}
	case EditorRoleName:
		switch providedRole {
		case EditorRoleName, AdminRoleName:
			return true
		}
	case AdminRoleName:
		switch providedRole {
		case AdminRoleName:
			return true
		}
	}

	return false
}
670376
func (ssecCopy) IsRequested(h http.Header) bool {
	if _, ok := h[SSECopyAlgorithm]; ok {
		return true
	}
	if _, ok := h[SSECopyKey]; ok {
		return true
	}
	if _, ok := h[SSECopyKeyMD5]; ok {
		return true
	}
	return false
}
296511
func (c *Client) IsAuthenticated() bool {
	authHeader, ok := c.Headers["Authorization"]

	if !ok || (ok && authHeader == "token ") {
		return false
	}

	return true
}