forked from loafle/openapi-generator-original
		
	Ignore auths when value not specified in Java clients
This commit is contained in:
		
							parent
							
								
									7c0fd4b85f
								
							
						
					
					
						commit
						e4ac6ef033
					
				| @ -44,6 +44,9 @@ public class ApiKeyAuth implements Authentication { | |||||||
| 
 | 
 | ||||||
|   @Override |   @Override | ||||||
|   public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) { |   public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) { | ||||||
|  |     if (apiKey == null) { | ||||||
|  |       return; | ||||||
|  |     } | ||||||
|     String value; |     String value; | ||||||
|     if (apiKeyPrefix != null) { |     if (apiKeyPrefix != null) { | ||||||
|       value = apiKeyPrefix + " " + apiKey; |       value = apiKeyPrefix + " " + apiKey; | ||||||
|  | |||||||
| @ -31,6 +31,9 @@ public class HttpBasicAuth implements Authentication { | |||||||
| 
 | 
 | ||||||
|   @Override |   @Override | ||||||
|   public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) { |   public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) { | ||||||
|  |     if (username == null && password == null) { | ||||||
|  |       return; | ||||||
|  |     } | ||||||
|     String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); |     String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); | ||||||
|     try { |     try { | ||||||
|       headerParams.put("Authorization", "Basic " + DatatypeConverter.printBase64Binary(str.getBytes("UTF-8"))); |       headerParams.put("Authorization", "Basic " + DatatypeConverter.printBase64Binary(str.getBytes("UTF-8"))); | ||||||
|  | |||||||
| @ -31,6 +31,9 @@ public class HttpBasicAuth implements Authentication { | |||||||
| 
 | 
 | ||||||
|   @Override |   @Override | ||||||
|   public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) { |   public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) { | ||||||
|  |     if (username == null && password == null) { | ||||||
|  |       return; | ||||||
|  |     } | ||||||
|     String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); |     String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); | ||||||
|     try { |     try { | ||||||
|       headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes("UTF-8"), false)); |       headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes("UTF-8"), false)); | ||||||
|  | |||||||
| @ -5,7 +5,7 @@ import io.swagger.client.Pair; | |||||||
| import java.util.Map; | import java.util.Map; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| 
 | 
 | ||||||
| @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-30T16:36:47.681+08:00") | @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-20T17:28:23.285+08:00") | ||||||
| public class ApiKeyAuth implements Authentication { | public class ApiKeyAuth implements Authentication { | ||||||
|   private final String location; |   private final String location; | ||||||
|   private final String paramName; |   private final String paramName; | ||||||
| @ -44,6 +44,9 @@ public class ApiKeyAuth implements Authentication { | |||||||
| 
 | 
 | ||||||
|   @Override |   @Override | ||||||
|   public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) { |   public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) { | ||||||
|  |     if (apiKey == null) { | ||||||
|  |       return; | ||||||
|  |     } | ||||||
|     String value; |     String value; | ||||||
|     if (apiKeyPrefix != null) { |     if (apiKeyPrefix != null) { | ||||||
|       value = apiKeyPrefix + " " + apiKey; |       value = apiKeyPrefix + " " + apiKey; | ||||||
|  | |||||||
| @ -8,7 +8,7 @@ import java.util.List; | |||||||
| import java.io.UnsupportedEncodingException; | import java.io.UnsupportedEncodingException; | ||||||
| import javax.xml.bind.DatatypeConverter; | import javax.xml.bind.DatatypeConverter; | ||||||
| 
 | 
 | ||||||
| @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-30T16:36:47.681+08:00") | @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-20T17:28:23.285+08:00") | ||||||
| public class HttpBasicAuth implements Authentication { | public class HttpBasicAuth implements Authentication { | ||||||
|   private String username; |   private String username; | ||||||
|   private String password; |   private String password; | ||||||
| @ -31,6 +31,9 @@ public class HttpBasicAuth implements Authentication { | |||||||
| 
 | 
 | ||||||
|   @Override |   @Override | ||||||
|   public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) { |   public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) { | ||||||
|  |     if (username == null && password == null) { | ||||||
|  |       return; | ||||||
|  |     } | ||||||
|     String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); |     String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); | ||||||
|     try { |     try { | ||||||
|       headerParams.put("Authorization", "Basic " + DatatypeConverter.printBase64Binary(str.getBytes("UTF-8"))); |       headerParams.put("Authorization", "Basic " + DatatypeConverter.printBase64Binary(str.getBytes("UTF-8"))); | ||||||
|  | |||||||
| @ -5,7 +5,7 @@ import io.swagger.client.Pair; | |||||||
| import java.util.Map; | import java.util.Map; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| 
 | 
 | ||||||
| @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-17T11:17:50.535-05:00") | @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-20T17:28:47.318+08:00") | ||||||
| public class ApiKeyAuth implements Authentication { | public class ApiKeyAuth implements Authentication { | ||||||
|   private final String location; |   private final String location; | ||||||
|   private final String paramName; |   private final String paramName; | ||||||
| @ -44,6 +44,9 @@ public class ApiKeyAuth implements Authentication { | |||||||
| 
 | 
 | ||||||
|   @Override |   @Override | ||||||
|   public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) { |   public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) { | ||||||
|  |     if (apiKey == null) { | ||||||
|  |       return; | ||||||
|  |     } | ||||||
|     String value; |     String value; | ||||||
|     if (apiKeyPrefix != null) { |     if (apiKeyPrefix != null) { | ||||||
|       value = apiKeyPrefix + " " + apiKey; |       value = apiKeyPrefix + " " + apiKey; | ||||||
|  | |||||||
| @ -8,7 +8,7 @@ import java.util.List; | |||||||
| import java.io.UnsupportedEncodingException; | import java.io.UnsupportedEncodingException; | ||||||
| import javax.xml.bind.DatatypeConverter; | import javax.xml.bind.DatatypeConverter; | ||||||
| 
 | 
 | ||||||
| @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-17T11:17:50.535-05:00") | @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-11-20T17:28:47.318+08:00") | ||||||
| public class HttpBasicAuth implements Authentication { | public class HttpBasicAuth implements Authentication { | ||||||
|   private String username; |   private String username; | ||||||
|   private String password; |   private String password; | ||||||
| @ -31,6 +31,9 @@ public class HttpBasicAuth implements Authentication { | |||||||
| 
 | 
 | ||||||
|   @Override |   @Override | ||||||
|   public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) { |   public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) { | ||||||
|  |     if (username == null && password == null) { | ||||||
|  |       return; | ||||||
|  |     } | ||||||
|     String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); |     String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); | ||||||
|     try { |     try { | ||||||
|       headerParams.put("Authorization", "Basic " + DatatypeConverter.printBase64Binary(str.getBytes("UTF-8"))); |       headerParams.put("Authorization", "Basic " + DatatypeConverter.printBase64Binary(str.getBytes("UTF-8"))); | ||||||
|  | |||||||
| @ -44,6 +44,9 @@ public class ApiKeyAuth implements Authentication { | |||||||
| 
 | 
 | ||||||
|   @Override |   @Override | ||||||
|   public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) { |   public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) { | ||||||
|  |     if (apiKey == null) { | ||||||
|  |       return; | ||||||
|  |     } | ||||||
|     String value; |     String value; | ||||||
|     if (apiKeyPrefix != null) { |     if (apiKeyPrefix != null) { | ||||||
|       value = apiKeyPrefix + " " + apiKey; |       value = apiKeyPrefix + " " + apiKey; | ||||||
|  | |||||||
| @ -31,6 +31,9 @@ public class HttpBasicAuth implements Authentication { | |||||||
| 
 | 
 | ||||||
|   @Override |   @Override | ||||||
|   public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) { |   public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) { | ||||||
|  |     if (username == null && password == null) { | ||||||
|  |       return; | ||||||
|  |     } | ||||||
|     String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); |     String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); | ||||||
|     try { |     try { | ||||||
|       headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes("UTF-8"), false)); |       headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes("UTF-8"), false)); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user