DoAuthorization

Used to authorize part of a previously placed order which was initiated as authType of Order
426793
function DoAuthorization($txnID, $amount = 0, $currency = 'USD', $entity = 'Order') {
    $values['TRANSACTIONID'] = $txnID;
    $values['AMT'] = number_format($amount, 2, '.', ',');
    $values['TRANSACTIONENTITY'] = $entity;
    $values['CURRENCYCODE'] = $currency;
    return $this->_request($values, 'DoAuthorization');
  }
977155
public void setAuthorized( boolean authorized ) {

        if( isAuthorized() != authorized ) {

            this.authorized = authorized;

            // We need to apply a change to our enabled state depending on our
            // new authorized state.
            if( authorized ) {
                // install the last requested enabled state
                setEnabled(maskedEnabledState);
            } else {
                // Record the current enabled state and then disable
                maskedEnabledState = isEnabled();
                internalSetEnabled(false);
            }
        }
    }
621891
function (auth, request, done) {
        var result,
            params = auth.get([
                'authId',
                'authKey',
                'algorithm',
                'nonce',
                'timestamp',
                'extraData',
                'app',
                'delegation',
                'user'
            ]),
            contentType = request.headers.get('content-type'),

            // force toString to add a protocol to the URL.
            url = urlEncoder.toNodeUrl(request.url.toString(true)),

            self = this;

        if (!params.authId || !params.authKey) {
            return done(); // Nothing to do if required parameters are not present.
        }

        request.removeHeader('Authorization', {ignoreCase: true});

        computeBodyHash(request.body, params.algorithm, 'base64', contentType, function (bodyHash) {
            result = self.computeHeader({
                credentials: {
                    id: params.authId,
                    key: params.authKey,
                    algorithm: params.algorithm
                },
                nonce: params.nonce,
                timestamp: params.timestamp,
                ext: params.extraData,
                app: params.app,
                dlg: params.delegation,
                user: params.user,
                url: url.href, // force toString to add a protocol to the URL.
                method: request.method,
                hash: bodyHash
            });
            request.addHeader({
                key: 'Authorization',
                value: result,
                system: true
            });

            return done();
        });
    }
802668
protected function _paymentAuthorize($oData)
    {
        $sId = $oData->AuthorizationDetails->AmazonAuthorizationId;
        $oOrder = $this->_loadOrderById('BESTITAMAZONAUTHORIZATIONID', $sId);

        if ($oOrder !== false && isset($oData->AuthorizationDetails->AuthorizationStatus->State)) {
            $this->getClient()->processAuthorization($oOrder, $oData->AuthorizationDetails);
            $this->logIPNResponse(Logger::INFO, 'OK', $oData);
            return true;
        }

        $this->logIPNResponse(Logger::ERROR, "Order with Authorization ID: {$sId} not found", $oData);
        return false;
    }
991197
function authorize(newDoc, oldDoc, userContext, securityInfo, docDefinition) {
    if (utils.isValueNullOrUndefined(userContext)) {
      throw unauthorizedResult();
    }

    var authorizedRoles = resolveRequiredAuthorizations(newDoc, oldDoc, docDefinition.authorizedRoles);
    var authorizedUsers = resolveRequiredAuthorizations(newDoc, oldDoc, docDefinition.authorizedUsers);
    var grantAllMembersWriteAccess = utils.resolveDocumentConstraint(docDefinition.grantAllMembersWriteAccess);

    if (grantAllMembersWriteAccess) {
      // The document definition allows any authenticated DB member to write documents of this type
      return authorizationSuccessResult(authorizedRoles, authorizedUsers);
    } else if (isAdminUser(userContext, securityInfo)) {
      // Database admins have unrestricted access
      return authorizationSuccessResult(authorizedRoles, authorizedUsers);
    } else if (!authorizedRoles && !authorizedUsers) {
      // The document type does not define any authorized roles or users
      throw forbiddenResult();
    }

    var roleMatch = hasAuthorizedRole(authorizedRoles, userContext.roles);
    var usernameMatch = hasAuthorizedUsername(authorizedUsers, userContext.name);
    if (!roleMatch && !usernameMatch) {
      // None of the required authorizations were satisfied
      throw forbiddenResult();
    } else {
      return authorizationSuccessResult(authorizedRoles, authorizedUsers);
    }
  }
1125638
public void clearAuthorizationData() {
        preferences.accessToken.clear();
        preferences.idToken.clear();
        preferences.userIdentity.clear();
        if (BMSClient.getInstance() != null && BMSClient.getInstance().getCookieManager() != null) {
            CookieStore cookieStore = BMSClient.getInstance().getCookieManager().getCookieStore();
            if(cookieStore != null) {
                for (URI uri : cookieStore.getURIs()) {
                    for (HttpCookie cookie : cookieStore.get(uri)) {
                        if (cookie.getName().equals(TAI_COOKIE_NAME)) {
                            cookieStore.remove(uri, cookie);
                        }
                    }
                }
            }
        }
    }
299751
public function setAuthenticationTypeDisplayOrder($order)
    {
        $db = Loader::db();
        $db->Execute(
           'UPDATE AuthenticationTypes SET authTypeDisplayOrder=? WHERE authTypeID=?',
           [$order, $this->getAuthenticationTypeID()]);
    }
622980
private function _performAuthAndCaptureForOrderShipment($shipmentNumber)
    {
        $response = $amazonAuthorizationId = $this->_performAuthorizationForShipment($shipmentNumber);
        $this->_waitUntilAuthorizationProcessingIsCompleted($amazonAuthorizationId);
        $this->_performCaptureForShipment($shipmentNumber, $amazonAuthorizationId);
    }
1107262
function(provider) {
        if (!this.isCurrent()) {
          return;
        }
        var authType;
        if (_.isString(provider)) {
          authType = provider;
          provider = AV.User._authProviders[authType];
        } else {
          authType = provider.getAuthType();
        }
        var authData = this.get('authData');
        if (!authData || !provider) {
          return;
        }
        var success = provider.restoreAuthentication(authData[authType]);
        if (!success) {
          this.dissociateAuthData(provider);
        }
      }
393869
protected void createDefaultAuthorizations(ProcessDefinition processDefinition) {
    if(isAuthorizationEnabled()) {
      ResourceAuthorizationProvider provider = getResourceAuthorizationProvider();
      AuthorizationEntity[] authorizations = provider.newProcessDefinition(processDefinition);
      saveDefaultAuthorizations(authorizations);
    }
  }
523581
def authorize!(action, subject, *args)
      message = args.last.is_a?(Hash) && args.last.key?(:message) ? args.pop[:message] : nil
      if cannot?(action, subject, *args)
        message ||= unauthorized_message(action, subject)
        raise AccessDenied.new(message, action, subject, args)
      end
      subject
    end
800665
public function authorizeAction()
    {
        $request = $this->getController()->request;
        $action = $request->getParam('action');

        $skipAuthorization = $this->checkAction($action, 'skipAuthorization');
        if ($skipAuthorization) {
            $this->skipAuthorization();

            return;
        }

        $authorizeModel = $this->checkAction($action, 'authorizeModel');
        if ($authorizeModel) {
            $this->authorize($this->getController()->loadModel());
        }
    }
1296440
public void setAuthorized(boolean authorized) {
		boolean wasAuthorized = isAuthorized();
		if (hasChanged(wasAuthorized, authorized)) {
			this.authorized = authorized;
			firePropertyChange(AUTHORIZED_PROPERTY, wasAuthorized, authorized);
			updatedEnabledState();
		}
	}
438316
private function _convertAuthorize($request) {
        
        $parameters = array();
        $parameters['Action'] = 'Authorize';
        if ($request->isSetSellerId()) {
            $parameters['SellerId'] =  $request->getSellerId();
        }
        if ($request->isSetAmazonOrderReferenceId()) {
            $parameters['AmazonOrderReferenceId'] =  $request->getAmazonOrderReferenceId();
        }
        if ($request->isSetAuthorizationReferenceId()) {
            $parameters['AuthorizationReferenceId'] =  $request->getAuthorizationReferenceId();
        }
        if ($request->isSetAuthorizationAmount()) {
            $authorizationAmount = $request->getAuthorizationAmount();
            if ($authorizationAmount->isSetAmount()) {
                $parameters['AuthorizationAmount' . '.' . 'Amount'] =  $authorizationAmount->getAmount();
            }
            if ($authorizationAmount->isSetCurrencyCode()) {
                $parameters['AuthorizationAmount' . '.' . 'CurrencyCode'] =  $authorizationAmount->getCurrencyCode();
            }
        }
        if ($request->isSetSellerAuthorizationNote()) {
            $parameters['SellerAuthorizationNote'] =  $request->getSellerAuthorizationNote();
        }
        if ($request->isSetOrderItemCategories()) {
            $orderItemCategories = $request->getOrderItemCategories();
            foreach  ($orderItemCategories->getOrderItemCategory() as $orderItemCategoryIndex => $orderItemCategory) {
                $parameters['OrderItemCategories' . '.' . 'OrderItemCategory' . '.'  . ($orderItemCategoryIndex + 1)] =  $orderItemCategory;
            }
        }
        if ($request->isSetTransactionTimeout()) {
            $parameters['TransactionTimeout'] =  $request->getTransactionTimeout();
        }
        if ($request->isSetCaptureNow()) {
            $parameters['CaptureNow'] =  $request->getCaptureNow() ? "true" : "false";
        }
        if ($request->isSetSoftDescriptor()) {
            $parameters['SoftDescriptor'] =  $request->getSoftDescriptor();
        }

        return $parameters;
    }
1137652
function authorize(req, res, next) {
  var authorized = req.session.authorized;
  var allows = req.route.allows;
  var allowed = false;

  if (is.string(allows)) {
    if (is.string(authorized)) {
      allowed = allows === authorized;
    } else if (is.array(authorized)) {
      allowed = authorized.indexOf(allows) > -1;
    }
  } else if (is.array(allows)) {
    if (is.string(authorized)) {
      allowed = allows.indexOf(authorized) > -1;
    } else if (is.array(authorized)) {
      for (var i = 0, l = authorized.length; i < l; i++) {
        allowed = allows.indexOf(authorized[i]) > -1;

        if (allowed) {
          break;
        }
      }
    }
  }

  debug(`${ req.method } ${ req.path } (${ allows }) : ` +
    `(${ authorized }) --> ${ allowed ? ALLOW : DENY }`);

  if (allowed) {
    return next();
  }

  res.sendStatus(403);
}
586973
function requireAuthorization(handler) {
  return function(request, response, store, parameters) {
    var handlerArguments = arguments
    var publisher = parameters.publisher
    var authorization = request.headers.authorization
    if (authorization) {
      var parsed = parseAuthorization(authorization)
      if (parsed === false || parsed.user !== publisher) {
        respond401(response) }
      else {
        checkPassword(publisher, parsed.password, function(error, valid) {
          if (error) {
            respond500(request, response, error) }
          else {
            if (valid) {
              handler.apply(this, handlerArguments) }
            else {
              respond401(response) } } }) } }
    else {
      respond401(response) } } }
718723
protected void createDefaultAuthorizations(UserEntity userEntity) {
    if(Context.getProcessEngineConfiguration().isAuthorizationEnabled()) {
      saveDefaultAuthorizations(getResourceAuthorizationProvider().newUser(userEntity));
    }
  }