forked from loafle/openapi-generator-original
[Java] [Kotlin] ignore unsupported schemes instead of throwing exception (#15817)
This commit is contained in:
parent
882b9a8c50
commit
0e212f53f2
@ -94,21 +94,14 @@ public class ApiClient {
|
||||
for(String authName : authNames) {
|
||||
log.log(Level.FINE, "Creating authentication {0}", authName);
|
||||
{{#hasAuthMethods}}
|
||||
RequestInterceptor auth;
|
||||
RequestInterceptor auth = null;
|
||||
{{#authMethods}}if ("{{name}}".equals(authName)) {
|
||||
{{#isBasic}}
|
||||
{{#isBasicBasic}}
|
||||
auth = new HttpBasicAuth();
|
||||
{{/isBasicBasic}}
|
||||
{{^isBasicBasic}}
|
||||
{{#isBasicBearer}}
|
||||
auth = new HttpBearerAuth("{{scheme}}");
|
||||
{{/isBasicBearer}}
|
||||
{{^isBasicBearer}}
|
||||
throw new RuntimeException("auth name \"" + authName + "\" does not have a supported http scheme type");
|
||||
{{/isBasicBearer}}
|
||||
{{/isBasicBasic}}
|
||||
{{/isBasic}}
|
||||
{{#isApiKey}}
|
||||
auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}");
|
||||
{{/isApiKey}}
|
||||
@ -118,7 +111,9 @@ public class ApiClient {
|
||||
} else {{/authMethods}}{
|
||||
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||
}
|
||||
addAuthorization(authName, auth);
|
||||
if (auth != null) {
|
||||
addAuthorization(authName, auth);
|
||||
}
|
||||
{{/hasAuthMethods}}
|
||||
{{^hasAuthMethods}}
|
||||
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||
|
@ -59,21 +59,14 @@ public class ApiClient {
|
||||
this();
|
||||
for(String authName : authNames) {
|
||||
{{#hasAuthMethods}}
|
||||
Interceptor auth;
|
||||
Interceptor auth = null;
|
||||
{{#authMethods}}if ("{{name}}".equals(authName)) {
|
||||
{{#isBasic}}
|
||||
{{#isBasicBasic}}
|
||||
auth = new HttpBasicAuth();
|
||||
{{/isBasicBasic}}
|
||||
{{^isBasicBasic}}
|
||||
{{#isBasicBearer}}
|
||||
auth = new HttpBearerAuth("{{scheme}}");
|
||||
{{/isBasicBearer}}
|
||||
{{^isBasicBearer}}
|
||||
throw new RuntimeException("auth name \"" + authName + "\" does not have a supported http scheme type");
|
||||
{{/isBasicBearer}}
|
||||
{{/isBasicBasic}}
|
||||
{{/isBasic}}
|
||||
{{#isApiKey}}
|
||||
auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}");
|
||||
{{/isApiKey}}
|
||||
@ -83,7 +76,9 @@ public class ApiClient {
|
||||
} else {{/authMethods}}{
|
||||
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||
}
|
||||
addAuthorization(authName, auth);
|
||||
if (auth != null) {
|
||||
addAuthorization(authName, auth);
|
||||
}
|
||||
{{/hasAuthMethods}}
|
||||
{{^hasAuthMethods}}
|
||||
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||
|
@ -66,15 +66,13 @@ public class ApiClient {
|
||||
this();
|
||||
for(String authName : authNames) {
|
||||
{{#hasAuthMethods}}
|
||||
Interceptor auth;
|
||||
Interceptor auth = null;
|
||||
{{#authMethods}}if ("{{name}}".equals(authName)) {
|
||||
{{#isBasic}}{{#isBasicBasic}}
|
||||
{{#isBasicBasic}}
|
||||
auth = new HttpBasicAuth();
|
||||
{{/isBasicBasic}}{{^isBasicBasic}}{{#isBasicBearer}}
|
||||
{{/isBasicBasic}}{{#isBasicBearer}}
|
||||
auth = new HttpBearerAuth("{{scheme}}");
|
||||
{{/isBasicBearer}}{{^isBasicBearer}}
|
||||
throw new RuntimeException("auth name \"" + authName + "\" does not have a supported http scheme type");
|
||||
{{/isBasicBearer}}{{/isBasicBasic}}{{/isBasic}}
|
||||
{{/isBasicBearer}}
|
||||
{{#isApiKey}}
|
||||
auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}");
|
||||
{{/isApiKey}}
|
||||
@ -84,8 +82,9 @@ public class ApiClient {
|
||||
} else {{/authMethods}}{
|
||||
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||
}
|
||||
|
||||
addAuthorization(authName, auth);
|
||||
if (auth != null) {
|
||||
addAuthorization(authName, auth);
|
||||
}
|
||||
{{/hasAuthMethods}}
|
||||
{{^hasAuthMethods}}
|
||||
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||
|
@ -127,11 +127,17 @@ import okhttp3.MediaType.Companion.toMediaType
|
||||
authNames: Array<String>
|
||||
) : this(baseUrl, okHttpClientBuilder{{^kotlinx_serialization}}, serializerBuilder{{/kotlinx_serialization}}) {
|
||||
authNames.forEach { authName ->
|
||||
val auth = when (authName) {
|
||||
{{#authMethods}}"{{name}}" -> {{#isBasic}}{{#isBasicBasic}}HttpBasicAuth(){{/isBasicBasic}}{{^isBasicBasic}}{{#isBasicBearer}}HttpBearerAuth("{{scheme}}"){{/isBasicBearer}}{{^isBasicBearer}}throw RuntimeException("auth name $authName does not have a supported http scheme type"){{/isBasicBearer}}{{/isBasicBasic}}{{/isBasic}}{{#isApiKey}}ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"){{/isApiKey}}{{#isOAuth}}OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{^-last}}, {{/-last}}{{/scopes}}"){{/isOAuth}}{{/authMethods}}
|
||||
val auth = when (authName) { {{#authMethods}}
|
||||
{{#isBasicBasic}}"{{name}}" -> HttpBasicAuth()
|
||||
{{/isBasicBasic}}{{#isBasicBearer}}"{{name}}" -> HttpBearerAuth("{{scheme}}")
|
||||
{{/isBasicBearer}}{{#isApiKey}}"{{name}}" -> ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}")
|
||||
{{/isApiKey}}{{#isOAuth}}"{{name}}" -> OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{^-last}}, {{/-last}}{{/scopes}}")
|
||||
{{/isOAuth}}{{^isBasicBasic}}{{^isBasicBearer}}{{^isApiKey}}{{^isOAuth}}"{{name}}" -> null{{/isOAuth}}{{/isApiKey}}{{/isBasicBearer}}{{/isBasicBasic}}{{/authMethods}}
|
||||
else -> throw RuntimeException("auth name $authName not found in available auth names")
|
||||
}
|
||||
addAuthorization(authName, auth)
|
||||
if (auth != null) {
|
||||
addAuthorization(authName, auth)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
{{#authMethods}}
|
||||
{{#isBasicBasic}}
|
||||
val principal = call.authentication.principal<UserIdPrincipal>()!!
|
||||
{{/isBasicBasic}}
|
||||
{{#isApiKey}}
|
||||
{{/isBasicBasic}}{{^isBasicBasic}}{{#isApiKey}}
|
||||
val principal = call.authentication.principal<ApiPrincipal>()!!
|
||||
{{/isApiKey}}
|
||||
{{#isOAuth}}
|
||||
{{/isApiKey}}{{^isApiKey}}{{#isOAuth}}
|
||||
val principal = call.authentication.principal<OAuthAccessTokenResponse>()!!
|
||||
{{/isOAuth}}
|
||||
{{/isOAuth}}{{^isOAuth}}
|
||||
val principal = null!!
|
||||
{{/isOAuth}}{{/isApiKey}}{{/isBasicBasic}}
|
||||
{{/authMethods}}
|
||||
|
@ -57,7 +57,7 @@ public class ApiClient {
|
||||
this();
|
||||
for(String authName : authNames) {
|
||||
log.log(Level.FINE, "Creating authentication {0}", authName);
|
||||
RequestInterceptor auth;
|
||||
RequestInterceptor auth = null;
|
||||
if ("petstore_auth".equals(authName)) {
|
||||
auth = buildOauthRequestInterceptor(OAuthFlow.IMPLICIT, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
|
||||
} else if ("api_key".equals(authName)) {
|
||||
@ -69,7 +69,9 @@ public class ApiClient {
|
||||
} else {
|
||||
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||
}
|
||||
addAuthorization(authName, auth);
|
||||
if (auth != null) {
|
||||
addAuthorization(authName, auth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ public class ApiClient {
|
||||
this();
|
||||
for(String authName : authNames) {
|
||||
log.log(Level.FINE, "Creating authentication {0}", authName);
|
||||
RequestInterceptor auth;
|
||||
RequestInterceptor auth = null;
|
||||
if ("petstore_auth".equals(authName)) {
|
||||
auth = buildOauthRequestInterceptor(OAuthFlow.IMPLICIT, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
|
||||
} else if ("api_key".equals(authName)) {
|
||||
@ -70,11 +70,12 @@ public class ApiClient {
|
||||
} else if ("bearer_test".equals(authName)) {
|
||||
auth = new HttpBearerAuth("bearer");
|
||||
} else if ("http_signature_test".equals(authName)) {
|
||||
throw new RuntimeException("auth name \"" + authName + "\" does not have a supported http scheme type");
|
||||
} else {
|
||||
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||
}
|
||||
addAuthorization(authName, auth);
|
||||
if (auth != null) {
|
||||
addAuthorization(authName, auth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,25 +52,21 @@ public class ApiClient {
|
||||
public ApiClient(String[] authNames) {
|
||||
this();
|
||||
for(String authName : authNames) {
|
||||
Interceptor auth;
|
||||
Interceptor auth = null;
|
||||
if ("petstore_auth".equals(authName)) {
|
||||
|
||||
auth = new OAuth(OAuthFlow.IMPLICIT, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
|
||||
} else if ("api_key".equals(authName)) {
|
||||
|
||||
auth = new ApiKeyAuth("header", "api_key");
|
||||
} else if ("api_key_query".equals(authName)) {
|
||||
|
||||
auth = new ApiKeyAuth("query", "api_key_query");
|
||||
} else if ("http_basic_test".equals(authName)) {
|
||||
|
||||
auth = new HttpBasicAuth();
|
||||
|
||||
} else {
|
||||
} else {
|
||||
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||
}
|
||||
|
||||
addAuthorization(authName, auth);
|
||||
if (auth != null) {
|
||||
addAuthorization(authName, auth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,25 +53,21 @@ public class ApiClient {
|
||||
public ApiClient(String[] authNames) {
|
||||
this();
|
||||
for(String authName : authNames) {
|
||||
Interceptor auth;
|
||||
Interceptor auth = null;
|
||||
if ("petstore_auth".equals(authName)) {
|
||||
|
||||
auth = new OAuth(OAuthFlow.IMPLICIT, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
|
||||
} else if ("api_key".equals(authName)) {
|
||||
|
||||
auth = new ApiKeyAuth("header", "api_key");
|
||||
} else if ("api_key_query".equals(authName)) {
|
||||
|
||||
auth = new ApiKeyAuth("query", "api_key_query");
|
||||
} else if ("http_basic_test".equals(authName)) {
|
||||
|
||||
auth = new HttpBasicAuth();
|
||||
|
||||
} else {
|
||||
} else {
|
||||
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||
}
|
||||
|
||||
addAuthorization(authName, auth);
|
||||
if (auth != null) {
|
||||
addAuthorization(authName, auth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,25 +53,21 @@ public class ApiClient {
|
||||
public ApiClient(String[] authNames) {
|
||||
this();
|
||||
for(String authName : authNames) {
|
||||
Interceptor auth;
|
||||
Interceptor auth = null;
|
||||
if ("petstore_auth".equals(authName)) {
|
||||
|
||||
auth = new OAuth(OAuthFlow.IMPLICIT, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
|
||||
} else if ("api_key".equals(authName)) {
|
||||
|
||||
auth = new ApiKeyAuth("header", "api_key");
|
||||
} else if ("api_key_query".equals(authName)) {
|
||||
|
||||
auth = new ApiKeyAuth("query", "api_key_query");
|
||||
} else if ("http_basic_test".equals(authName)) {
|
||||
|
||||
auth = new HttpBasicAuth();
|
||||
|
||||
} else {
|
||||
} else {
|
||||
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||
}
|
||||
|
||||
addAuthorization(authName, auth);
|
||||
if (auth != null) {
|
||||
addAuthorization(authName, auth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,11 +72,16 @@ class ApiClient(
|
||||
authNames: Array<String>
|
||||
) : this(baseUrl, okHttpClientBuilder) {
|
||||
authNames.forEach { authName ->
|
||||
val auth = when (authName) {
|
||||
"petstore_auth" -> OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets")"api_key" -> ApiKeyAuth("header", "api_key")
|
||||
val auth = when (authName) {
|
||||
"petstore_auth" -> OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets")
|
||||
|
||||
"api_key" -> ApiKeyAuth("header", "api_key")
|
||||
|
||||
else -> throw RuntimeException("auth name $authName not found in available auth names")
|
||||
}
|
||||
addAuthorization(authName, auth)
|
||||
if (auth != null) {
|
||||
addAuthorization(authName, auth)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,11 +74,16 @@ class ApiClient(
|
||||
authNames: Array<String>
|
||||
) : this(baseUrl, okHttpClientBuilder, serializerBuilder) {
|
||||
authNames.forEach { authName ->
|
||||
val auth = when (authName) {
|
||||
"petstore_auth" -> OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets")"api_key" -> ApiKeyAuth("header", "api_key")
|
||||
val auth = when (authName) {
|
||||
"petstore_auth" -> OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets")
|
||||
|
||||
"api_key" -> ApiKeyAuth("header", "api_key")
|
||||
|
||||
else -> throw RuntimeException("auth name $authName not found in available auth names")
|
||||
}
|
||||
addAuthorization(authName, auth)
|
||||
if (auth != null) {
|
||||
addAuthorization(authName, auth)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,11 +72,16 @@ class ApiClient(
|
||||
authNames: Array<String>
|
||||
) : this(baseUrl, okHttpClientBuilder, serializerBuilder) {
|
||||
authNames.forEach { authName ->
|
||||
val auth = when (authName) {
|
||||
"petstore_auth" -> OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets")"api_key" -> ApiKeyAuth("header", "api_key")
|
||||
val auth = when (authName) {
|
||||
"petstore_auth" -> OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets")
|
||||
|
||||
"api_key" -> ApiKeyAuth("header", "api_key")
|
||||
|
||||
else -> throw RuntimeException("auth name $authName not found in available auth names")
|
||||
}
|
||||
addAuthorization(authName, auth)
|
||||
if (auth != null) {
|
||||
addAuthorization(authName, auth)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,24 +35,30 @@ fun Route.PetApi() {
|
||||
|
||||
authenticate("petstore_auth") {
|
||||
post<Paths.addPet> {
|
||||
|
||||
val principal = call.authentication.principal<OAuthAccessTokenResponse>()!!
|
||||
|
||||
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
}
|
||||
}
|
||||
|
||||
authenticate("petstore_auth") {
|
||||
delete<Paths.deletePet> {
|
||||
|
||||
val principal = call.authentication.principal<OAuthAccessTokenResponse>()!!
|
||||
|
||||
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
}
|
||||
}
|
||||
|
||||
authenticate("petstore_auth") {
|
||||
get<Paths.findPetsByStatus> {
|
||||
|
||||
val principal = call.authentication.principal<OAuthAccessTokenResponse>()!!
|
||||
|
||||
|
||||
val exampleContentType = "application/json"
|
||||
val exampleContentString = """[ {
|
||||
"photoUrls" : [ "photoUrls", "photoUrls" ],
|
||||
@ -98,8 +104,10 @@ fun Route.PetApi() {
|
||||
|
||||
authenticate("petstore_auth") {
|
||||
get<Paths.findPetsByTags> {
|
||||
|
||||
val principal = call.authentication.principal<OAuthAccessTokenResponse>()!!
|
||||
|
||||
|
||||
val exampleContentType = "application/json"
|
||||
val exampleContentString = """[ {
|
||||
"photoUrls" : [ "photoUrls", "photoUrls" ],
|
||||
@ -145,8 +153,10 @@ fun Route.PetApi() {
|
||||
|
||||
authenticate("api_key") {
|
||||
get<Paths.getPetById> {
|
||||
|
||||
val principal = call.authentication.principal<ApiPrincipal>()!!
|
||||
|
||||
|
||||
val exampleContentType = "application/json"
|
||||
val exampleContentString = """{
|
||||
"photoUrls" : [ "photoUrls", "photoUrls" ],
|
||||
@ -176,24 +186,30 @@ fun Route.PetApi() {
|
||||
|
||||
authenticate("petstore_auth") {
|
||||
put<Paths.updatePet> {
|
||||
|
||||
val principal = call.authentication.principal<OAuthAccessTokenResponse>()!!
|
||||
|
||||
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
}
|
||||
}
|
||||
|
||||
authenticate("petstore_auth") {
|
||||
post<Paths.updatePetWithForm> {
|
||||
|
||||
val principal = call.authentication.principal<OAuthAccessTokenResponse>()!!
|
||||
|
||||
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
}
|
||||
}
|
||||
|
||||
authenticate("petstore_auth") {
|
||||
post<Paths.uploadFile> {
|
||||
|
||||
val principal = call.authentication.principal<OAuthAccessTokenResponse>()!!
|
||||
|
||||
|
||||
val exampleContentType = "application/json"
|
||||
val exampleContentString = """{
|
||||
"code" : 0,
|
||||
|
@ -38,8 +38,10 @@ fun Route.StoreApi() {
|
||||
|
||||
authenticate("api_key") {
|
||||
get<Paths.getInventory> {
|
||||
|
||||
val principal = call.authentication.principal<ApiPrincipal>()!!
|
||||
|
||||
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
}
|
||||
}
|
||||
|
@ -35,24 +35,30 @@ fun Route.PetApi() {
|
||||
|
||||
authenticate("petstore_auth") {
|
||||
post<Paths.addPet> {
|
||||
|
||||
val principal = call.authentication.principal<OAuthAccessTokenResponse>()!!
|
||||
|
||||
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
}
|
||||
}
|
||||
|
||||
authenticate("petstore_auth") {
|
||||
delete<Paths.deletePet> {
|
||||
|
||||
val principal = call.authentication.principal<OAuthAccessTokenResponse>()!!
|
||||
|
||||
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
}
|
||||
}
|
||||
|
||||
authenticate("petstore_auth") {
|
||||
get<Paths.findPetsByStatus> {
|
||||
|
||||
val principal = call.authentication.principal<OAuthAccessTokenResponse>()!!
|
||||
|
||||
|
||||
val exampleContentType = "application/json"
|
||||
val exampleContentString = """[ {
|
||||
"photoUrls" : [ "photoUrls", "photoUrls" ],
|
||||
@ -98,8 +104,10 @@ fun Route.PetApi() {
|
||||
|
||||
authenticate("petstore_auth") {
|
||||
get<Paths.findPetsByTags> {
|
||||
|
||||
val principal = call.authentication.principal<OAuthAccessTokenResponse>()!!
|
||||
|
||||
|
||||
val exampleContentType = "application/json"
|
||||
val exampleContentString = """[ {
|
||||
"photoUrls" : [ "photoUrls", "photoUrls" ],
|
||||
@ -145,8 +153,10 @@ fun Route.PetApi() {
|
||||
|
||||
authenticate("api_key") {
|
||||
get<Paths.getPetById> {
|
||||
|
||||
val principal = call.authentication.principal<ApiPrincipal>()!!
|
||||
|
||||
|
||||
val exampleContentType = "application/json"
|
||||
val exampleContentString = """{
|
||||
"photoUrls" : [ "photoUrls", "photoUrls" ],
|
||||
@ -176,24 +186,30 @@ fun Route.PetApi() {
|
||||
|
||||
authenticate("petstore_auth") {
|
||||
put<Paths.updatePet> {
|
||||
|
||||
val principal = call.authentication.principal<OAuthAccessTokenResponse>()!!
|
||||
|
||||
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
}
|
||||
}
|
||||
|
||||
authenticate("petstore_auth") {
|
||||
post<Paths.updatePetWithForm> {
|
||||
|
||||
val principal = call.authentication.principal<OAuthAccessTokenResponse>()!!
|
||||
|
||||
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
}
|
||||
}
|
||||
|
||||
authenticate("petstore_auth") {
|
||||
post<Paths.uploadFile> {
|
||||
|
||||
val principal = call.authentication.principal<OAuthAccessTokenResponse>()!!
|
||||
|
||||
|
||||
val exampleContentType = "application/json"
|
||||
val exampleContentString = """{
|
||||
"code" : 0,
|
||||
|
@ -38,8 +38,10 @@ fun Route.StoreApi() {
|
||||
|
||||
authenticate("api_key") {
|
||||
get<Paths.getInventory> {
|
||||
|
||||
val principal = call.authentication.principal<ApiPrincipal>()!!
|
||||
|
||||
|
||||
call.respond(HttpStatusCode.NotImplemented)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user