mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-05-17 08:31:23 +00:00
Setup authentications in test cases
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
package {{invokerPackage}}.auth;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class OAuth implements Authentication {
|
||||
@Override
|
||||
public void processParams(Map<String, String> queryParams, Map<String, String> headerParams) {
|
||||
// TODO: support oauth
|
||||
}
|
||||
}
|
||||
@@ -6,16 +6,18 @@ import java.util.HashMap;
|
||||
import {{invokerPackage}}.auth.Authentication;
|
||||
import {{invokerPackage}}.auth.HttpBasicAuth;
|
||||
import {{invokerPackage}}.auth.ApiKeyAuth;
|
||||
import {{invokerPackage}}.auth.OAuth;
|
||||
|
||||
public class Configuration {
|
||||
private static final Map<String, Authentication> AUTH;
|
||||
|
||||
static {
|
||||
// setup authentications
|
||||
AUTH = new HashMap<String, Authentication>();
|
||||
{{#authMethods}}
|
||||
{{#isBasic}}AUTH.put("{{name}}", new HttpBasicAuth());{{/isBasic}}
|
||||
{{#isApiKey}}AUTH.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"));{{/isApiKey}}
|
||||
{{#isOAuth}}// TODO: support oauth{{/isOAuth}}
|
||||
{{#isOAuth}}AUTH.put("{{name}}", new OAuth());{{/isOAuth}}
|
||||
{{/authMethods}}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user