int Request(int _first, struct Node* _t, struct Node* _l, struct Position* _p) { if (_first==true) { if (_l->owner == _t) { return -1; } requestEvent(_t, _l, _p); checkForCycles(_t); } if (!_p->inHist) { return -1; } grant(_p, _t); int i = 0; while (i < histSize) { if (contains(&history[i], _p)) { if (instance(&history[i], 0)) { yieldEvent(_t, &history[i]); ungrant(_p, _t); checkForCycles(_t); return i; } } i = i + 1; } grantEvent(_t, _l, _p); return -1; }
Errors::Code DefaultClientAuthorizationFacade::processAuthorizationRequest(const IHttpRequest& request, IHttpResponse &response) const { if (!request.isParamExist(_acceptedFieldName)) { make_error_response(Errors::Code::access_denied, "user denided access to client", request, response); return Errors::Code::access_denied; } if (!request.isParamExist(_userIdFieldName) || !request.isParamExist(Params::client_id) || !request.isParamExist(Params::scope)) { make_error_response(Errors::Code::invalid_request, "no one or more required parameters user_id, client_id, scope", request, response); return Errors::Code::access_denied; } Grant grant(request.getParam(_userIdFieldName), request.getParam(Params::client_id), request.getParam(Params::scope)); ServiceLocator::instance()->Storage->saveGrant(grant); //HACK: should use POST UserAuthenticationFacadeMock::_originalRequestFieldName parameter response.addHeader("Location", request.getHeader("Referer")); response.setStatus(302); return Errors::ok; };