-
Notifications
You must be signed in to change notification settings - Fork 478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Basic Authentication #492
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.influxdb.impl; | ||
|
||
import java.io.IOException; | ||
|
||
import okhttp3.Credentials; | ||
import okhttp3.Interceptor; | ||
import okhttp3.Request; | ||
import okhttp3.Response; | ||
|
||
public class BasicAuthInterceptor implements Interceptor { | ||
|
||
private String credentials; | ||
|
||
public BasicAuthInterceptor(final String user, final String password) { | ||
credentials = Credentials.basic(user, password); | ||
} | ||
|
||
@Override | ||
public Response intercept(final Chain chain) throws IOException { | ||
Request request = chain.request(); | ||
Request authenticatedRequest = request.newBuilder().header("Authorization", credentials).build(); | ||
return chain.proceed(authenticatedRequest); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,49 +39,44 @@ interface InfluxDBService { | |
* Can be one of one, any, all, quorum. Defaults to all. | ||
*/ | ||
@POST("write") | ||
public Call<ResponseBody> writePoints(@Query(U) String username, | ||
@Query(P) String password, @Query(DB) String database, | ||
public Call<ResponseBody> writePoints(@Query(DB) String database, | ||
@Query(RP) String retentionPolicy, @Query(PRECISION) String precision, | ||
@Query(CONSISTENCY) String consistency, @Body RequestBody batchPoints); | ||
|
||
@GET("query") | ||
public Call<QueryResult> query(@Query(U) String username, @Query(P) String password, @Query(DB) String db, | ||
public Call<QueryResult> query(@Query(DB) String db, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. parameters removed: (non-backward compatible change) |
||
@Query(EPOCH) String epoch, @Query(value = Q, encoded = true) String query); | ||
|
||
@POST("query") | ||
public Call<QueryResult> query(@Query(U) String username, @Query(P) String password, @Query(DB) String db, | ||
public Call<QueryResult> query(@Query(DB) String db, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. parameters removed: (non-backward compatible change) |
||
@Query(EPOCH) String epoch, @Query(value = Q, encoded = true) String query, | ||
@Query(value = PARAMS, encoded = true) String params); | ||
|
||
@GET("query") | ||
public Call<QueryResult> query(@Query(U) String username, @Query(P) String password, @Query(DB) String db, | ||
public Call<QueryResult> query(@Query(DB) String db, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. parameters removed: (non-backward compatible change) |
||
@Query(value = Q, encoded = true) String query); | ||
|
||
@POST("query") | ||
public Call<QueryResult> postQuery(@Query(U) String username, @Query(P) String password, @Query(DB) String db, | ||
public Call<QueryResult> postQuery(@Query(DB) String db, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. parameters removed: (non-backward compatible change) |
||
@Query(value = Q, encoded = true) String query); | ||
|
||
@POST("query") | ||
public Call<QueryResult> postQuery(@Query(U) String username, @Query(P) String password, @Query(DB) String db, | ||
public Call<QueryResult> postQuery(@Query(DB) String db, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. parameters removed: (non-backward compatible change) |
||
@Query(value = Q, encoded = true) String query, @Query(value = PARAMS, encoded = true) String params); | ||
|
||
@GET("query") | ||
public Call<QueryResult> query(@Query(U) String username, @Query(P) String password, | ||
@Query(value = Q, encoded = true) String query); | ||
public Call<QueryResult> query(@Query(value = Q, encoded = true) String query); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. parameters removed: (non-backward compatible change) |
||
|
||
@POST("query") | ||
public Call<QueryResult> postQuery(@Query(U) String username, | ||
@Query(P) String password, @Query(value = Q, encoded = true) String query); | ||
public Call<QueryResult> postQuery(@Query(value = Q, encoded = true) String query); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. parameters removed: (non-backward compatible change) |
||
|
||
@Streaming | ||
@GET("query?chunked=true") | ||
public Call<ResponseBody> query(@Query(U) String username, | ||
@Query(P) String password, @Query(DB) String db, @Query(value = Q, encoded = true) String query, | ||
public Call<ResponseBody> query(@Query(DB) String db, @Query(value = Q, encoded = true) String query, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. parameters removed: (non-backward compatible change) |
||
@Query(CHUNK_SIZE) int chunkSize); | ||
|
||
@Streaming | ||
@POST("query?chunked=true") | ||
public Call<ResponseBody> query(@Query(U) String username, | ||
@Query(P) String password, @Query(DB) String db, @Query(value = Q, encoded = true) String query, | ||
public Call<ResponseBody> query(@Query(DB) String db, @Query(value = Q, encoded = true) String query, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. parameters removed: (non-backward compatible change) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, InfluxDBService provides only a internal API which @lxhoan adopted, the only visible API is InfluxDB,java and that didnt change. Or did i miss something ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the method signatures are all public however the interface (InfluxDBService) itself is visible to org.influxdb.impl only, so I don't think user can import this interface in their implementation |
||
@Query(CHUNK_SIZE) int chunkSize, @Query(value = PARAMS, encoded = true) String params); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parameters removed: (non-backward compatible change)