Authorizations below here
761613
def index_authorize
        if !::Authorization::Fbuser::V1::User.index?(current_user)
          render :json => {errors: "User is not authorized for this action"}, status: :forbidden
        end
      end
652668
function authorize(route, req, res, next) {
  var allowed = true;

  if (type.is(route.allows, Array)) {
    allowed = route.allows.indexOf(req.session.authorized) > -1;
  } else if (type.is(route.allows, String)) {
    allowed = route.allows === req.session.authorized;
  }

  debug(req.method + " " + req.path + " [" + route.allows + "][" + req.session.authorized + "] : " + (allowed ? "OK" : "DENY"));

  if (allowed) {
    return next();
  }

  res.status(403).end();
}
229369
protected function _authorize()
    {
        return ( bool ) (
            $this->getSession()->checkSessionChallenge()
            && count(\OxidEsales\Eshop\Core\Registry::getUtilsServer()->getOxCookie())
            && \OxidEsales\Eshop\Core\Registry::getUtils()->checkAccessRights()
        );
    }
722988
public function authorize()
    {
        $crude = CrudeInstance::get($this->crudeName);

        if ($crude == null)
            return false;

        return true;
    }
182819
def permitted_to! (privilege, options = {} )
      options = {
        :user =>  Authorization.current_user,
        :object => self
      }.merge(options)
      Authorization::Engine.instance.permit!(privilege,
          {:user => options[:user],
           :object => options[:object]})
    end
116490
function onAuthorizedAccess() {
          if (angular.isFunction(permission.onAuthorized)) {
            permission.onAuthorized()($element);
          } else {
            var onAuthorizedMethodName = $permission.defaultOnAuthorizedMethod;
            PermPermissionStrategies[onAuthorizedMethodName]($element);
          }
        }
387814
def authorize_for(opts = {})
      authorize! opts[:action], opts[:resource] if opts[:resource].present?
      authorize! opts[:action], opts[:object] if opts[:object].present?
    end
989137
def make_auth_headers(self, content_type):
        """"""
        headers = self.make_headers(content_type)
        headers['Authorization'] = 'Basic {}'.format(self.get_auth_string())
        return headers
730105
function authenticateUser (req, res, next) {
  // Check for verified access token
  if (req.claims && req.claims.sub) {
    User.get(req.claims.sub, function (err, user) {
      if (err) {
        return next(err)
      }

      if (!user) {
        return next(new UnauthorizedError({
          realm: 'user',
          error: 'unknown_user',
          error_description: 'Unknown user',
          statusCode: 401
        }))
      }

      req.user = user
      next()
    })

  // User is not authenticated.
  } else if (!req.user) {
    next(new UnauthorizedError({
      statusCode: 401
    }))

  // User is authenticated.
  } else {
    next()
  }
}
866724
def index
      authorizations = Corkboard::Authorization.all
      providers      = authorizations.map(&:provider)
      available      = Corkboard.services.reject { |s| providers.include?(s) }

      render(:index, :locals => {
        :activated => authorizations,
        :available => available
      })
    end
1006157
function DiscogsOAuth(auth){
	this.config = util.merge({}, defaultConfig);
	this.auth = {method: 'oauth', level: 0};
	if(auth && (typeof auth === 'object') && (auth.method === 'oauth')){
		util.merge(this.auth, auth);
	}
}
871672
def authorize(auth = {})
      @authentication ||= TaskMapper::Authenticator.new(auth)
      auth = @authentication
      if (auth.username.nil? || auth.url.nil? || auth.password.nil?)
        raise "Please provide username, password and url"
      end
      url = auth.url.gsub(/\/$/,'')
      unless url.split('/').last == 'xmlrpc.cgi'
        auth.url = url+'/xmlrpc.cgi'
      end
      @bugzilla = Rubyzilla::Bugzilla.new(auth.url)
      begin
        @bugzilla.login(auth.username,auth.password)
      rescue
        warn 'Authentication was invalid'
      end
    end
157767
function auth(app, config) {
  /* Ensure authorizer */
  if (is.not.function(config.authorizer)) {
    throw new Error(ERR_AUTHORIZER);
  }

  /* Check debug type */
  if (is.function(config.debug)) {
    debug = config.debug;
  } else if (config.debug) {
    debug = console.log.bind(console);
  }

  /* Set the authorized property in 'req.session' */
  app.use((req, res, next) => {
    req.session.authorized = config.authorizer(req);
    next();
  });

  /* Set authorization rules for each route */
  config.routes.forEach((route) => {
    route = normalize(route);

    var router = app.route(route.path);

    if (is.array(route.method) && route.method.length) {
      route.method.forEach((method) => {
        logAssignment(method, route.path, route.allows);
        router[method](generate(route.allows), authorize);
      });
    } else if (is.string(route.method)) {
      logAssignment(route.method, route.path, route.allows);
      router[route.method](generate(route.allows), authorize);
    } else {
      logAssignment(ALL, route.path, route.allows);
      router.all(generate(route.allows), authorize);
    }
  });
}
412563
def get_authorization_user(self, **kwargs):
        """"""
        if self.authorization_user is not None:
            return self.authorization_user

        self.authorization_user = self.request.user
        return self.request.user
640644
def authorization_header(oauth_params):
        """"""
        authorization_headers = 'OAuth realm="",'
        authorization_headers += ','.join(['{0}="{1}"'.format(k, urllib.quote(str(v)))
            for k, v in oauth_params.items()])
        return authorization_headers
116018
function authorize(req, res, next) {
  const role = findRoleFromRequest(
    req,
    options.roleSearchPath,
    options.defaultRole,
    options.decodedObjectName
  );

  if (req.originalUrl === '/') {
    return next();
  }

  const policy = options.policies.get(role);

  if (!policy) {
    return res.status(403).json({
      status: 'Access denied',
      success: false,
      message: `REQUIRED: Policy for role ${role} is not defined`
    });
  }

  const permission = findPermissionForRoute(
    req.originalUrl,
    req.method,
    options.baseUrl,
    policy
  );

  if (!permission) {
    if (typeof options.denyCallback === 'function') {
      return options.denyCallback(res);
    }
    return res.status(403).json(deny(options.customMessage, options.response));
  }

  return checkIfHasAccess(
    req.method,
    res,
    next,
    permission,
    options.customMessage,
    options.response,
    options.denyCallback
  );
}
269305
public function cmdLineAuth()
    {

        $authUrl = $this->client->createAuthUrl();
        //Request authorization
        print "Please visit:\n$authUrl\n\n";
        print "Please enter the auth code:\n";
        $authCode = trim(fgets(STDIN));
        // Exchange authorization code for access token
        $accessToken = $this->client->authenticate($authCode);

        $this->client->setAccessToken($accessToken);
        $this->accessToken = $accessToken;
        $this->refreshToken = $this->client->getRefreshToken();
    }