Родитель
32dc76e2d0
Коммит
d841c893b8
|
@ -13,14 +13,13 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import logging
|
||||
|
||||
import google.oauth2.id_token
|
||||
import werkzeug.exceptions
|
||||
from chromestatus_openapi.models import SignInRequest
|
||||
from google.auth.transport import requests
|
||||
|
||||
from framework import basehandlers
|
||||
from framework import users
|
||||
import settings
|
||||
from framework import basehandlers, users
|
||||
|
||||
|
||||
class LoginAPI(basehandlers.APIHandler):
|
||||
|
@ -31,8 +30,14 @@ class LoginAPI(basehandlers.APIHandler):
|
|||
self.abort(405, valid_methods=['POST'])
|
||||
|
||||
def do_post(self, **kwargs):
|
||||
token = self.get_param('credential')
|
||||
message = "Unable to Authenticate. Please sign in again."
|
||||
try:
|
||||
request = SignInRequest.from_dict(self.request.json)
|
||||
token = request.credential
|
||||
if not token:
|
||||
raise werkzeug.exceptions.BadRequest(description="Missing required field 'credential'")
|
||||
message = "Unable to Authenticate. Please sign in again."
|
||||
except ValueError:
|
||||
message = "Invalid Request"
|
||||
|
||||
try:
|
||||
idinfo = google.oauth2.id_token.verify_oauth2_token(
|
||||
|
|
|
@ -13,23 +13,20 @@
|
|||
# limitations under the License.
|
||||
|
||||
import concurrent.futures
|
||||
import flask
|
||||
import json5
|
||||
import logging
|
||||
import requests
|
||||
import urllib.request
|
||||
import validators
|
||||
from base64 import b64decode
|
||||
|
||||
from framework import basehandlers
|
||||
from framework import origin_trials_client
|
||||
import flask
|
||||
import json5
|
||||
import requests
|
||||
import validators
|
||||
|
||||
from framework import basehandlers, origin_trials_client, permissions
|
||||
from internals import notifier_helpers
|
||||
from framework import permissions
|
||||
from internals.core_enums import OT_READY_FOR_CREATION
|
||||
from internals.core_models import FeatureEntry, Stage
|
||||
from internals.review_models import Gate, Vote
|
||||
|
||||
|
||||
WEBFEATURE_FILE_URL = 'https://chromium.googlesource.com/chromium/src/+/main/third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom?format=TEXT'
|
||||
ENABLED_FEATURES_FILE_URL = 'https://chromium.googlesource.com/chromium/src/+/main/third_party/blink/renderer/platform/runtime_enabled_features.json5?format=TEXT'
|
||||
GRACE_PERIOD_FILE = 'https://chromium.googlesource.com/chromium/src/+/main/third_party/blink/common/origin_trials/manual_completion_origin_trial_features.cc?format=TEXT'
|
||||
|
|
|
@ -58,7 +58,9 @@ src/models/PostVoteRequest.ts
|
|||
src/models/Process.ts
|
||||
src/models/ProcessStage.ts
|
||||
src/models/ProgressItem.ts
|
||||
src/models/RejectUnneededGetRequest.ts
|
||||
src/models/ReviewLatency.ts
|
||||
src/models/SignInRequest.ts
|
||||
src/models/SpecMentor.ts
|
||||
src/models/SuccessMessage.ts
|
||||
src/models/TokenRefreshResponse.ts
|
||||
|
|
|
@ -41,10 +41,11 @@ import type {
|
|||
PostIntentRequest,
|
||||
PostVoteRequest,
|
||||
Process,
|
||||
RejectUnneededGetRequest,
|
||||
ReviewLatency,
|
||||
SignInRequest,
|
||||
SpecMentor,
|
||||
SuccessMessage,
|
||||
TokenRefreshResponse,
|
||||
} from '../models/index';
|
||||
import {
|
||||
AccountResponseFromJSON,
|
||||
|
@ -99,14 +100,16 @@ import {
|
|||
PostVoteRequestToJSON,
|
||||
ProcessFromJSON,
|
||||
ProcessToJSON,
|
||||
RejectUnneededGetRequestFromJSON,
|
||||
RejectUnneededGetRequestToJSON,
|
||||
ReviewLatencyFromJSON,
|
||||
ReviewLatencyToJSON,
|
||||
SignInRequestFromJSON,
|
||||
SignInRequestToJSON,
|
||||
SpecMentorFromJSON,
|
||||
SpecMentorToJSON,
|
||||
SuccessMessageFromJSON,
|
||||
SuccessMessageToJSON,
|
||||
TokenRefreshResponseFromJSON,
|
||||
TokenRefreshResponseToJSON,
|
||||
} from '../models/index';
|
||||
|
||||
export interface AddFeatureCommentRequest {
|
||||
|
@ -131,6 +134,10 @@ export interface AddXfnGatesToStageRequest {
|
|||
stageId: number;
|
||||
}
|
||||
|
||||
export interface AuthenticateUserRequest {
|
||||
signInRequest: SignInRequest;
|
||||
}
|
||||
|
||||
export interface CreateAccountOperationRequest {
|
||||
createAccountRequest?: CreateAccountRequest;
|
||||
}
|
||||
|
@ -310,6 +317,21 @@ export interface DefaultApiInterface {
|
|||
*/
|
||||
addXfnGatesToStage(requestParameters: AddXfnGatesToStageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SuccessMessage>;
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary Authenticate user with Google Sign-In
|
||||
* @param {SignInRequest} signInRequest
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof DefaultApiInterface
|
||||
*/
|
||||
authenticateUserRaw(requestParameters: AuthenticateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SuccessMessage>>;
|
||||
|
||||
/**
|
||||
* Authenticate user with Google Sign-In
|
||||
*/
|
||||
authenticateUser(requestParameters: AuthenticateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SuccessMessage>;
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary Create a new account
|
||||
|
@ -643,6 +665,20 @@ export interface DefaultApiInterface {
|
|||
*/
|
||||
listSpecMentors(requestParameters: ListSpecMentorsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<SpecMentor>>;
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary Log out the current user
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof DefaultApiInterface
|
||||
*/
|
||||
logoutUserRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SuccessMessage>>;
|
||||
|
||||
/**
|
||||
* Log out the current user
|
||||
*/
|
||||
logoutUser(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SuccessMessage>;
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary Submit an intent to be posted on blink-dev
|
||||
|
@ -668,12 +704,40 @@ export interface DefaultApiInterface {
|
|||
* @throws {RequiredError}
|
||||
* @memberof DefaultApiInterface
|
||||
*/
|
||||
refreshTokenRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TokenRefreshResponse>>;
|
||||
refreshTokenRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<ReviewLatency>>>;
|
||||
|
||||
/**
|
||||
* Refresh the XSRF token
|
||||
*/
|
||||
refreshToken(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TokenRefreshResponse>;
|
||||
refreshToken(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<ReviewLatency>>;
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary reject unneeded GET request without triggering Error Reporting
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof DefaultApiInterface
|
||||
*/
|
||||
rejectGetRequestsLoginRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
||||
|
||||
/**
|
||||
* reject unneeded GET request without triggering Error Reporting
|
||||
*/
|
||||
rejectGetRequestsLogin(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary reject unneeded GET request without triggering Error Reporting
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof DefaultApiInterface
|
||||
*/
|
||||
rejectGetRequestsLogoutRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
||||
|
||||
/**
|
||||
* reject unneeded GET request without triggering Error Reporting
|
||||
*/
|
||||
rejectGetRequestsLogout(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -914,6 +978,42 @@ export class DefaultApi extends runtime.BaseAPI implements DefaultApiInterface {
|
|||
return await response.value();
|
||||
}
|
||||
|
||||
/**
|
||||
* Authenticate user with Google Sign-In
|
||||
*/
|
||||
async authenticateUserRaw(requestParameters: AuthenticateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SuccessMessage>> {
|
||||
if (requestParameters['signInRequest'] == null) {
|
||||
throw new runtime.RequiredError(
|
||||
'signInRequest',
|
||||
'Required parameter "signInRequest" was null or undefined when calling authenticateUser().'
|
||||
);
|
||||
}
|
||||
|
||||
const queryParameters: any = {};
|
||||
|
||||
const headerParameters: runtime.HTTPHeaders = {};
|
||||
|
||||
headerParameters['Content-Type'] = 'application/json';
|
||||
|
||||
const response = await this.request({
|
||||
path: `/login`,
|
||||
method: 'POST',
|
||||
headers: headerParameters,
|
||||
query: queryParameters,
|
||||
body: SignInRequestToJSON(requestParameters['signInRequest']),
|
||||
}, initOverrides);
|
||||
|
||||
return new runtime.JSONApiResponse(response, (jsonValue) => SuccessMessageFromJSON(jsonValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Authenticate user with Google Sign-In
|
||||
*/
|
||||
async authenticateUser(requestParameters: AuthenticateUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SuccessMessage> {
|
||||
const response = await this.authenticateUserRaw(requestParameters, initOverrides);
|
||||
return await response.value();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new account
|
||||
*/
|
||||
|
@ -1651,6 +1751,32 @@ export class DefaultApi extends runtime.BaseAPI implements DefaultApiInterface {
|
|||
return await response.value();
|
||||
}
|
||||
|
||||
/**
|
||||
* Log out the current user
|
||||
*/
|
||||
async logoutUserRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SuccessMessage>> {
|
||||
const queryParameters: any = {};
|
||||
|
||||
const headerParameters: runtime.HTTPHeaders = {};
|
||||
|
||||
const response = await this.request({
|
||||
path: `/logout`,
|
||||
method: 'POST',
|
||||
headers: headerParameters,
|
||||
query: queryParameters,
|
||||
}, initOverrides);
|
||||
|
||||
return new runtime.JSONApiResponse(response, (jsonValue) => SuccessMessageFromJSON(jsonValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Log out the current user
|
||||
*/
|
||||
async logoutUser(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SuccessMessage> {
|
||||
const response = await this.logoutUserRaw(initOverrides);
|
||||
return await response.value();
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit an intent to be posted on blink-dev
|
||||
*/
|
||||
|
@ -1704,7 +1830,7 @@ export class DefaultApi extends runtime.BaseAPI implements DefaultApiInterface {
|
|||
/**
|
||||
* Refresh the XSRF token
|
||||
*/
|
||||
async refreshTokenRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TokenRefreshResponse>> {
|
||||
async refreshTokenRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<ReviewLatency>>> {
|
||||
const queryParameters: any = {};
|
||||
|
||||
const headerParameters: runtime.HTTPHeaders = {};
|
||||
|
@ -1716,17 +1842,67 @@ export class DefaultApi extends runtime.BaseAPI implements DefaultApiInterface {
|
|||
query: queryParameters,
|
||||
}, initOverrides);
|
||||
|
||||
return new runtime.JSONApiResponse(response, (jsonValue) => TokenRefreshResponseFromJSON(jsonValue));
|
||||
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(ReviewLatencyFromJSON));
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh the XSRF token
|
||||
*/
|
||||
async refreshToken(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TokenRefreshResponse> {
|
||||
async refreshToken(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<ReviewLatency>> {
|
||||
const response = await this.refreshTokenRaw(initOverrides);
|
||||
return await response.value();
|
||||
}
|
||||
|
||||
/**
|
||||
* reject unneeded GET request without triggering Error Reporting
|
||||
*/
|
||||
async rejectGetRequestsLoginRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
||||
const queryParameters: any = {};
|
||||
|
||||
const headerParameters: runtime.HTTPHeaders = {};
|
||||
|
||||
const response = await this.request({
|
||||
path: `/login`,
|
||||
method: 'GET',
|
||||
headers: headerParameters,
|
||||
query: queryParameters,
|
||||
}, initOverrides);
|
||||
|
||||
return new runtime.VoidApiResponse(response);
|
||||
}
|
||||
|
||||
/**
|
||||
* reject unneeded GET request without triggering Error Reporting
|
||||
*/
|
||||
async rejectGetRequestsLogin(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
||||
await this.rejectGetRequestsLoginRaw(initOverrides);
|
||||
}
|
||||
|
||||
/**
|
||||
* reject unneeded GET request without triggering Error Reporting
|
||||
*/
|
||||
async rejectGetRequestsLogoutRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
||||
const queryParameters: any = {};
|
||||
|
||||
const headerParameters: runtime.HTTPHeaders = {};
|
||||
|
||||
const response = await this.request({
|
||||
path: `/logout`,
|
||||
method: 'GET',
|
||||
headers: headerParameters,
|
||||
query: queryParameters,
|
||||
}, initOverrides);
|
||||
|
||||
return new runtime.VoidApiResponse(response);
|
||||
}
|
||||
|
||||
/**
|
||||
* reject unneeded GET request without triggering Error Reporting
|
||||
*/
|
||||
async rejectGetRequestsLogout(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
||||
await this.rejectGetRequestsLogoutRaw(initOverrides);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a user from a component
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* chomestatus API
|
||||
* The API for chromestatus.com. chromestatus.com is the official tool used for tracking feature launches in Blink (the browser engine that powers Chrome and many other web browsers). This tool guides feature owners through our launch process and serves as a primary source for developer information that then ripples throughout the web developer ecosystem. More details at: https://github.com/GoogleChrome/chromium-dashboard
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @interface RejectUnneededGetRequest
|
||||
*/
|
||||
export interface RejectUnneededGetRequest {
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof RejectUnneededGetRequest
|
||||
*/
|
||||
message?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the RejectUnneededGetRequest interface.
|
||||
*/
|
||||
export function instanceOfRejectUnneededGetRequest(value: object): value is RejectUnneededGetRequest {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function RejectUnneededGetRequestFromJSON(json: any): RejectUnneededGetRequest {
|
||||
return RejectUnneededGetRequestFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function RejectUnneededGetRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): RejectUnneededGetRequest {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'message': json['message'] == null ? undefined : json['message'],
|
||||
};
|
||||
}
|
||||
|
||||
export function RejectUnneededGetRequestToJSON(value?: RejectUnneededGetRequest | null): any {
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'message': value['message'],
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* chomestatus API
|
||||
* The API for chromestatus.com. chromestatus.com is the official tool used for tracking feature launches in Blink (the browser engine that powers Chrome and many other web browsers). This tool guides feature owners through our launch process and serves as a primary source for developer information that then ripples throughout the web developer ecosystem. More details at: https://github.com/GoogleChrome/chromium-dashboard
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @interface SignInRequest
|
||||
*/
|
||||
export interface SignInRequest {
|
||||
/**
|
||||
* The credential generated by Sign-In With Google.
|
||||
* @type {string}
|
||||
* @memberof SignInRequest
|
||||
*/
|
||||
credential: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the SignInRequest interface.
|
||||
*/
|
||||
export function instanceOfSignInRequest(value: object): value is SignInRequest {
|
||||
if (!('credential' in value) || value['credential'] === undefined) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function SignInRequestFromJSON(json: any): SignInRequest {
|
||||
return SignInRequestFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function SignInRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): SignInRequest {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'credential': json['credential'],
|
||||
};
|
||||
}
|
||||
|
||||
export function SignInRequestToJSON(value?: SignInRequest | null): any {
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'credential': value['credential'],
|
||||
};
|
||||
}
|
||||
|
|
@ -52,7 +52,9 @@ export * from './PostVoteRequest';
|
|||
export * from './Process';
|
||||
export * from './ProcessStage';
|
||||
export * from './ProgressItem';
|
||||
export * from './RejectUnneededGetRequest';
|
||||
export * from './ReviewLatency';
|
||||
export * from './SignInRequest';
|
||||
export * from './SpecMentor';
|
||||
export * from './SuccessMessage';
|
||||
export * from './TokenRefreshResponse';
|
||||
|
|
|
@ -64,7 +64,9 @@ chromestatus_openapi/models/post_vote_request.py
|
|||
chromestatus_openapi/models/process.py
|
||||
chromestatus_openapi/models/process_stage.py
|
||||
chromestatus_openapi/models/progress_item.py
|
||||
chromestatus_openapi/models/reject_unneeded_get_request.py
|
||||
chromestatus_openapi/models/review_latency.py
|
||||
chromestatus_openapi/models/sign_in_request.py
|
||||
chromestatus_openapi/models/spec_mentor.py
|
||||
chromestatus_openapi/models/success_message.py
|
||||
chromestatus_openapi/models/token_refresh_response.py
|
||||
|
|
|
@ -29,10 +29,11 @@ from chromestatus_openapi.models.post_gate_request import PostGateRequest # noq
|
|||
from chromestatus_openapi.models.post_intent_request import PostIntentRequest # noqa: E501
|
||||
from chromestatus_openapi.models.post_vote_request import PostVoteRequest # noqa: E501
|
||||
from chromestatus_openapi.models.process import Process # noqa: E501
|
||||
from chromestatus_openapi.models.reject_unneeded_get_request import RejectUnneededGetRequest # noqa: E501
|
||||
from chromestatus_openapi.models.review_latency import ReviewLatency # noqa: E501
|
||||
from chromestatus_openapi.models.sign_in_request import SignInRequest # noqa: E501
|
||||
from chromestatus_openapi.models.spec_mentor import SpecMentor # noqa: E501
|
||||
from chromestatus_openapi.models.success_message import SuccessMessage # noqa: E501
|
||||
from chromestatus_openapi.models.token_refresh_response import TokenRefreshResponse # noqa: E501
|
||||
from chromestatus_openapi import util
|
||||
|
||||
|
||||
|
@ -106,6 +107,21 @@ def add_xfn_gates_to_stage(feature_id, stage_id): # noqa: E501
|
|||
return 'do some magic!'
|
||||
|
||||
|
||||
def authenticate_user(sign_in_request): # noqa: E501
|
||||
"""Authenticate user with Google Sign-In
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param sign_in_request:
|
||||
:type sign_in_request: dict | bytes
|
||||
|
||||
:rtype: Union[SuccessMessage, Tuple[SuccessMessage, int], Tuple[SuccessMessage, int, Dict[str, str]]
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
sign_in_request = SignInRequest.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def create_account(create_account_request=None): # noqa: E501
|
||||
"""Create a new account
|
||||
|
||||
|
@ -405,6 +421,17 @@ def list_spec_mentors(after=None): # noqa: E501
|
|||
return 'do some magic!'
|
||||
|
||||
|
||||
def logout_user(): # noqa: E501
|
||||
"""Log out the current user
|
||||
|
||||
# noqa: E501
|
||||
|
||||
|
||||
:rtype: Union[SuccessMessage, Tuple[SuccessMessage, int], Tuple[SuccessMessage, int, Dict[str, str]]
|
||||
"""
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def post_intent_to_blink_dev(feature_id, stage_id, gate_id, post_intent_request=None): # noqa: E501
|
||||
"""Submit an intent to be posted on blink-dev
|
||||
|
||||
|
@ -432,7 +459,29 @@ def refresh_token(): # noqa: E501
|
|||
# noqa: E501
|
||||
|
||||
|
||||
:rtype: Union[TokenRefreshResponse, Tuple[TokenRefreshResponse, int], Tuple[TokenRefreshResponse, int, Dict[str, str]]
|
||||
:rtype: Union[List[ReviewLatency], Tuple[List[ReviewLatency], int], Tuple[List[ReviewLatency], int, Dict[str, str]]
|
||||
"""
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def reject_get_requests_login(): # noqa: E501
|
||||
"""reject unneeded GET request without triggering Error Reporting
|
||||
|
||||
# noqa: E501
|
||||
|
||||
|
||||
:rtype: Union[None, Tuple[None, int], Tuple[None, int, Dict[str, str]]
|
||||
"""
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def reject_get_requests_logout(): # noqa: E501
|
||||
"""reject unneeded GET request without triggering Error Reporting
|
||||
|
||||
# noqa: E501
|
||||
|
||||
|
||||
:rtype: Union[None, Tuple[None, int], Tuple[None, int, Dict[str, str]]
|
||||
"""
|
||||
return 'do some magic!'
|
||||
|
||||
|
|
|
@ -52,7 +52,9 @@ from chromestatus_openapi.models.post_vote_request import PostVoteRequest
|
|||
from chromestatus_openapi.models.process import Process
|
||||
from chromestatus_openapi.models.process_stage import ProcessStage
|
||||
from chromestatus_openapi.models.progress_item import ProgressItem
|
||||
from chromestatus_openapi.models.reject_unneeded_get_request import RejectUnneededGetRequest
|
||||
from chromestatus_openapi.models.review_latency import ReviewLatency
|
||||
from chromestatus_openapi.models.sign_in_request import SignInRequest
|
||||
from chromestatus_openapi.models.spec_mentor import SpecMentor
|
||||
from chromestatus_openapi.models.success_message import SuccessMessage
|
||||
from chromestatus_openapi.models.token_refresh_response import TokenRefreshResponse
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
from datetime import date, datetime # noqa: F401
|
||||
|
||||
from typing import List, Dict # noqa: F401
|
||||
|
||||
from chromestatus_openapi.models.base_model import Model
|
||||
from chromestatus_openapi import util
|
||||
|
||||
|
||||
class RejectUnneededGetRequest(Model):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
def __init__(self, message=None): # noqa: E501
|
||||
"""RejectUnneededGetRequest - a model defined in OpenAPI
|
||||
|
||||
:param message: The message of this RejectUnneededGetRequest. # noqa: E501
|
||||
:type message: str
|
||||
"""
|
||||
self.openapi_types = {
|
||||
'message': str
|
||||
}
|
||||
|
||||
self.attribute_map = {
|
||||
'message': 'message'
|
||||
}
|
||||
|
||||
self._message = message
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, dikt) -> 'RejectUnneededGetRequest':
|
||||
"""Returns the dict as a model
|
||||
|
||||
:param dikt: A dict.
|
||||
:type: dict
|
||||
:return: The RejectUnneededGetRequest of this RejectUnneededGetRequest. # noqa: E501
|
||||
:rtype: RejectUnneededGetRequest
|
||||
"""
|
||||
return util.deserialize_model(dikt, cls)
|
||||
|
||||
@property
|
||||
def message(self) -> str:
|
||||
"""Gets the message of this RejectUnneededGetRequest.
|
||||
|
||||
|
||||
:return: The message of this RejectUnneededGetRequest.
|
||||
:rtype: str
|
||||
"""
|
||||
return self._message
|
||||
|
||||
@message.setter
|
||||
def message(self, message: str):
|
||||
"""Sets the message of this RejectUnneededGetRequest.
|
||||
|
||||
|
||||
:param message: The message of this RejectUnneededGetRequest.
|
||||
:type message: str
|
||||
"""
|
||||
|
||||
self._message = message
|
|
@ -0,0 +1,65 @@
|
|||
from datetime import date, datetime # noqa: F401
|
||||
|
||||
from typing import List, Dict # noqa: F401
|
||||
|
||||
from chromestatus_openapi.models.base_model import Model
|
||||
from chromestatus_openapi import util
|
||||
|
||||
|
||||
class SignInRequest(Model):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
def __init__(self, credential=None): # noqa: E501
|
||||
"""SignInRequest - a model defined in OpenAPI
|
||||
|
||||
:param credential: The credential of this SignInRequest. # noqa: E501
|
||||
:type credential: str
|
||||
"""
|
||||
self.openapi_types = {
|
||||
'credential': str
|
||||
}
|
||||
|
||||
self.attribute_map = {
|
||||
'credential': 'credential'
|
||||
}
|
||||
|
||||
self._credential = credential
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, dikt) -> 'SignInRequest':
|
||||
"""Returns the dict as a model
|
||||
|
||||
:param dikt: A dict.
|
||||
:type: dict
|
||||
:return: The SignInRequest of this SignInRequest. # noqa: E501
|
||||
:rtype: SignInRequest
|
||||
"""
|
||||
return util.deserialize_model(dikt, cls)
|
||||
|
||||
@property
|
||||
def credential(self) -> str:
|
||||
"""Gets the credential of this SignInRequest.
|
||||
|
||||
The credential generated by Sign-In With Google. # noqa: E501
|
||||
|
||||
:return: The credential of this SignInRequest.
|
||||
:rtype: str
|
||||
"""
|
||||
return self._credential
|
||||
|
||||
@credential.setter
|
||||
def credential(self, credential: str):
|
||||
"""Sets the credential of this SignInRequest.
|
||||
|
||||
The credential generated by Sign-In With Google. # noqa: E501
|
||||
|
||||
:param credential: The credential of this SignInRequest.
|
||||
:type credential: str
|
||||
"""
|
||||
if credential is None:
|
||||
raise ValueError("Invalid value for `credential`, must not be `None`") # noqa: E501
|
||||
|
||||
self._credential = credential
|
|
@ -201,7 +201,9 @@ paths:
|
|||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/TokenRefreshResponse'
|
||||
items:
|
||||
$ref: '#/components/schemas/ReviewLatency'
|
||||
type: array
|
||||
description: Successfully refreshed the token.
|
||||
summary: Refresh the XSRF token
|
||||
x-openapi-router-controller: chromestatus_openapi.controllers.default_controller
|
||||
|
@ -876,6 +878,64 @@ paths:
|
|||
description: A list of all pending gates.
|
||||
summary: Get all pending gates
|
||||
x-openapi-router-controller: chromestatus_openapi.controllers.default_controller
|
||||
/login:
|
||||
get:
|
||||
operationId: reject_get_requests_login
|
||||
responses:
|
||||
"405":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/RejectUnneededGetRequest'
|
||||
description: Method Not Allowed
|
||||
summary: reject unneeded GET request without triggering Error Reporting
|
||||
x-openapi-router-controller: chromestatus_openapi.controllers.default_controller
|
||||
post:
|
||||
operationId: authenticate_user
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/SignInRequest'
|
||||
required: true
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/SuccessMessage'
|
||||
description: User authenticated successfully
|
||||
"401":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorMessage'
|
||||
description: Invalid Token
|
||||
summary: Authenticate user with Google Sign-In
|
||||
x-openapi-router-controller: chromestatus_openapi.controllers.default_controller
|
||||
/logout:
|
||||
get:
|
||||
operationId: reject_get_requests_logout
|
||||
responses:
|
||||
"405":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/RejectUnneededGetRequest'
|
||||
description: Method Not Allowed
|
||||
summary: reject unneeded GET request without triggering Error Reporting
|
||||
x-openapi-router-controller: chromestatus_openapi.controllers.default_controller
|
||||
post:
|
||||
operationId: logout_user
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/SuccessMessage'
|
||||
description: User logged out successfully
|
||||
summary: Log out the current user
|
||||
x-openapi-router-controller: chromestatus_openapi.controllers.default_controller
|
||||
/review-latency:
|
||||
get:
|
||||
operationId: list_reviews_with_latency
|
||||
|
@ -1773,6 +1833,18 @@ components:
|
|||
- gate_reviews
|
||||
title: ReviewLatency
|
||||
type: object
|
||||
SignInRequest:
|
||||
example:
|
||||
credential: credential
|
||||
properties:
|
||||
credential:
|
||||
description: The credential generated by Sign-In With Google.
|
||||
title: credential
|
||||
type: string
|
||||
required:
|
||||
- credential
|
||||
title: SignInRequest
|
||||
type: object
|
||||
GateLatency:
|
||||
example:
|
||||
gate_type: 0
|
||||
|
@ -2237,17 +2309,11 @@ components:
|
|||
title: DismissCueRequest
|
||||
type: object
|
||||
TokenRefreshResponse:
|
||||
example:
|
||||
token_expires_sec: 0
|
||||
token: token
|
||||
properties:
|
||||
token:
|
||||
title: token
|
||||
type: string
|
||||
token_expires_sec:
|
||||
title: token_expires_sec
|
||||
type: integer
|
||||
title: TokenRefreshResponse
|
||||
type: object
|
||||
SuccessMessage:
|
||||
example:
|
||||
|
@ -2269,6 +2335,16 @@ components:
|
|||
type: string
|
||||
title: ErrorMessage
|
||||
type: object
|
||||
RejectUnneededGetRequest:
|
||||
example:
|
||||
message: Method Not Allowed
|
||||
properties:
|
||||
message:
|
||||
example: Method Not Allowed
|
||||
title: message
|
||||
type: string
|
||||
title: RejectUnneededGetRequest
|
||||
type: object
|
||||
deleteAccount_200_response:
|
||||
example:
|
||||
message: Done
|
||||
|
|
|
@ -28,10 +28,11 @@ from chromestatus_openapi.models.post_gate_request import PostGateRequest # noq
|
|||
from chromestatus_openapi.models.post_intent_request import PostIntentRequest # noqa: E501
|
||||
from chromestatus_openapi.models.post_vote_request import PostVoteRequest # noqa: E501
|
||||
from chromestatus_openapi.models.process import Process # noqa: E501
|
||||
from chromestatus_openapi.models.reject_unneeded_get_request import RejectUnneededGetRequest # noqa: E501
|
||||
from chromestatus_openapi.models.review_latency import ReviewLatency # noqa: E501
|
||||
from chromestatus_openapi.models.sign_in_request import SignInRequest # noqa: E501
|
||||
from chromestatus_openapi.models.spec_mentor import SpecMentor # noqa: E501
|
||||
from chromestatus_openapi.models.success_message import SuccessMessage # noqa: E501
|
||||
from chromestatus_openapi.models.token_refresh_response import TokenRefreshResponse # noqa: E501
|
||||
from chromestatus_openapi.test import BaseTestCase
|
||||
|
||||
|
||||
|
@ -110,6 +111,25 @@ class TestDefaultController(BaseTestCase):
|
|||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_authenticate_user(self):
|
||||
"""Test case for authenticate_user
|
||||
|
||||
Authenticate user with Google Sign-In
|
||||
"""
|
||||
sign_in_request = {"credential":"credential"}
|
||||
headers = {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
}
|
||||
response = self.client.open(
|
||||
'/api/v0/login',
|
||||
method='POST',
|
||||
headers=headers,
|
||||
data=json.dumps(sign_in_request),
|
||||
content_type='application/json')
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_create_account(self):
|
||||
"""Test case for create_account
|
||||
|
||||
|
@ -463,6 +483,21 @@ class TestDefaultController(BaseTestCase):
|
|||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_logout_user(self):
|
||||
"""Test case for logout_user
|
||||
|
||||
Log out the current user
|
||||
"""
|
||||
headers = {
|
||||
'Accept': 'application/json',
|
||||
}
|
||||
response = self.client.open(
|
||||
'/api/v0/logout',
|
||||
method='POST',
|
||||
headers=headers)
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_post_intent_to_blink_dev(self):
|
||||
"""Test case for post_intent_to_blink_dev
|
||||
|
||||
|
@ -497,6 +532,36 @@ class TestDefaultController(BaseTestCase):
|
|||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_reject_get_requests_login(self):
|
||||
"""Test case for reject_get_requests_login
|
||||
|
||||
reject unneeded GET request without triggering Error Reporting
|
||||
"""
|
||||
headers = {
|
||||
'Accept': 'application/json',
|
||||
}
|
||||
response = self.client.open(
|
||||
'/api/v0/login',
|
||||
method='GET',
|
||||
headers=headers)
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_reject_get_requests_logout(self):
|
||||
"""Test case for reject_get_requests_logout
|
||||
|
||||
reject unneeded GET request without triggering Error Reporting
|
||||
"""
|
||||
headers = {
|
||||
'Accept': 'application/json',
|
||||
}
|
||||
response = self.client.open(
|
||||
'/api/v0/logout',
|
||||
method='GET',
|
||||
headers=headers)
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
def test_remove_user_from_component(self):
|
||||
"""Test case for remove_user_from_component
|
||||
|
||||
|
|
|
@ -438,6 +438,60 @@ paths:
|
|||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/ReviewLatency'
|
||||
/login:
|
||||
get:
|
||||
summary: reject unneeded GET request without triggering Error Reporting
|
||||
operationId: rejectGetRequestsLogin
|
||||
responses:
|
||||
'405':
|
||||
description: Method Not Allowed
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/RejectUnneededGetRequest'
|
||||
post:
|
||||
summary: Authenticate user with Google Sign-In
|
||||
operationId: authenticateUser
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/SignInRequest'
|
||||
responses:
|
||||
'200':
|
||||
description: User authenticated successfully
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/SuccessMessage'
|
||||
'401':
|
||||
description: Invalid Token
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ErrorMessage'
|
||||
/logout:
|
||||
get:
|
||||
summary: reject unneeded GET request without triggering Error Reporting
|
||||
operationId: rejectGetRequestsLogout
|
||||
responses:
|
||||
'405':
|
||||
description: Method Not Allowed
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/RejectUnneededGetRequest'
|
||||
post:
|
||||
summary: Log out the current user
|
||||
operationId: logoutUser
|
||||
responses:
|
||||
'200':
|
||||
description: User logged out successfully
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/SuccessMessage'
|
||||
/currentuser/permissions:
|
||||
get:
|
||||
summary: Get the permissions and email of the user
|
||||
|
@ -504,7 +558,9 @@ paths:
|
|||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/TokenRefreshResponse'
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/ReviewLatency'
|
||||
/external_reviews/{review_group}:
|
||||
get:
|
||||
summary: List features whose external reviews are incomplete
|
||||
|
@ -1124,6 +1180,14 @@ components:
|
|||
required:
|
||||
- feature
|
||||
- gate_reviews
|
||||
SignInRequest:
|
||||
type: object
|
||||
properties:
|
||||
credential:
|
||||
type: string
|
||||
description: The credential generated by Sign-In With Google.
|
||||
required:
|
||||
- credential
|
||||
GateLatency:
|
||||
type: object
|
||||
required:
|
||||
|
@ -1464,3 +1528,9 @@ components:
|
|||
error:
|
||||
type: string
|
||||
example: "Error"
|
||||
RejectUnneededGetRequest:
|
||||
type: object
|
||||
properties:
|
||||
message:
|
||||
type: string
|
||||
example: "Method Not Allowed"
|
||||
|
|
Загрузка…
Ссылка в новой задаче