@autorest/codemodel
Version:
AutoRest code model library
119 lines • 4.71 kB
TypeScript
import { Initializer, DeepPartial } from "@azure-tools/codegen";
import { Extensions } from "../common/extensions";
import { uri } from "../common/uri";
import { ParameterLocation } from "./parameter-location";
export declare enum Scheme {
Bearer = "bearer"
}
export declare enum SecurityType {
ApiKey = "apiKey",
Http = "http",
OAuth2 = "oauth2",
OpenIDConnect = "openIdConnect"
}
export interface AuthorizationCodeOAuthFlow extends Extensions {
authorizationUrl: uri;
tokenUrl: uri;
refreshUrl?: uri;
scopes: Record<string, string>;
}
export interface BearerHTTPSecurityScheme extends Extensions {
scheme: Scheme.Bearer;
bearerFormat?: string;
type: SecurityType.Http;
description?: string;
}
export interface ClientCredentialsFlow extends Extensions {
tokenUrl: uri;
refreshUrl?: uri;
scopes: Record<string, string>;
}
export interface ImplicitOAuthFlow extends Extensions {
authorizationUrl: uri;
refreshUrl?: uri;
scopes: Record<string, string>;
}
export interface NonBearerHTTPSecurityScheme extends Extensions {
scheme: string;
description?: string;
type: SecurityType.Http;
}
export interface OAuth2SecurityScheme extends Extensions {
type: SecurityType.OAuth2;
flows: OAuthFlows;
description?: string;
}
export interface OAuthFlows extends Extensions {
implicit?: ImplicitOAuthFlow;
password?: PasswordOAuthFlow;
clientCredentials?: ClientCredentialsFlow;
authorizationCode?: AuthorizationCodeOAuthFlow;
}
export type HTTPSecurityScheme = NonBearerHTTPSecurityScheme | BearerHTTPSecurityScheme;
export type SecurityScheme = APIKeySecurityScheme | HTTPSecurityScheme | OAuth2SecurityScheme | OpenIdConnectSecurityScheme;
export interface APIKeySecurityScheme extends Extensions {
type: SecurityType.ApiKey;
name: string;
in: ParameterLocation;
description?: string;
}
export declare class APIKeySecurityScheme extends Initializer implements APIKeySecurityScheme {
name: string;
constructor(name: string, inWhere: ParameterLocation, initializer?: DeepPartial<APIKeySecurityScheme>);
}
export declare class BearerHTTPSecurityScheme extends Initializer implements BearerHTTPSecurityScheme {
scheme: Scheme;
constructor(initializer?: DeepPartial<BearerHTTPSecurityScheme>);
}
export declare class ImplicitOAuthFlow extends Initializer implements ImplicitOAuthFlow {
authorizationUrl: string;
scopes: Record<string, string>;
constructor(authorizationUrl: string, initializer?: DeepPartial<ImplicitOAuthFlow>);
}
export declare class NonBearerHTTPSecurityScheme extends Initializer implements NonBearerHTTPSecurityScheme {
scheme: string;
constructor(scheme: string, initializer?: DeepPartial<NonBearerHTTPSecurityScheme>);
}
export declare class OAuth2SecurityScheme extends Initializer implements OAuth2SecurityScheme {
flows: OAuthFlows;
constructor(flows: OAuthFlows, initializer?: DeepPartial<OAuth2SecurityScheme>);
}
export declare class OAuthFlows extends Initializer implements OAuthFlows {
constructor(initializer?: DeepPartial<OAuthFlows>);
}
export interface OpenIdConnectSecurityScheme extends Extensions {
type: SecurityType.OpenIDConnect;
openIdConnectUrl: uri;
description?: string;
}
export declare class OpenIdConnectSecurityScheme extends Initializer implements OpenIdConnectSecurityScheme {
openIdConnectUrl: string;
constructor(openIdConnectUrl: string, initializer?: DeepPartial<OpenIdConnectSecurityScheme>);
}
export interface PasswordOAuthFlow extends Extensions {
tokenUrl: uri;
refreshUrl?: uri;
scopes: Record<string, string>;
}
export declare class PasswordOAuthFlow extends Initializer implements PasswordOAuthFlow {
tokenUrl: string;
scopes: Record<string, string>;
constructor(tokenUrl: string, initializer?: DeepPartial<PasswordOAuthFlow>);
}
export declare class AuthorizationCodeOAuthFlow extends Initializer implements AuthorizationCodeOAuthFlow {
authorizationUrl: string;
scopes: Record<string, string>;
constructor(authorizationUrl: string, tokenUrl: string, initializer?: DeepPartial<AuthorizationCodeOAuthFlow>);
}
export declare class ClientCredentialsFlow extends Initializer implements ClientCredentialsFlow {
tokenUrl: string;
scopes: Record<string, string>;
constructor(tokenUrl: string, initializer?: DeepPartial<ClientCredentialsFlow>);
}
/**
* @description common ways of serializing simple parameters
* @see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#style-values
*/
export interface SecurityRequirement extends Record<string, string> {
}
//# sourceMappingURL=security.d.ts.map