Skip to content

Commit 8c33b7d

Browse files
authored
[BREAKING CHANGE] Drop authentication related arguments from ChannelA… (#1157)
…ccessTokenClient. The endpoint is not require authenticaiton informantion.
1 parent da009fb commit 8c33b7d

File tree

10 files changed

+57
-277
lines changed

10 files changed

+57
-277
lines changed

clients/line-channel-access-token-client/.openapi-generator/FILES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ src/main/java/com/linecorp/bot/oauth/model/IssueChannelAccessTokenResponse.java
55
src/main/java/com/linecorp/bot/oauth/model/IssueShortLivedChannelAccessTokenResponse.java
66
src/main/java/com/linecorp/bot/oauth/model/IssueStatelessChannelAccessTokenResponse.java
77
src/main/java/com/linecorp/bot/oauth/model/VerifyChannelAccessTokenResponse.java
8+
src/test/java/com/linecorp/bot/oauth/client/ChannelAccessTokenClientTest.java

clients/line-channel-access-token-client/src/main/java/com/linecorp/bot/oauth/client/ChannelAccessTokenClient.java

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@
2020
*/
2121
package com.linecorp.bot.oauth.client;
2222

23-
import com.linecorp.bot.client.base.ApiAuthenticatedClientBuilder;
23+
import com.linecorp.bot.client.base.ApiClientBuilder;
2424
import com.linecorp.bot.client.base.Result;
25-
import com.linecorp.bot.client.base.channel.ChannelTokenSupplier;
2625
import com.linecorp.bot.oauth.model.ChannelAccessTokenKeyIdsResponse;
2726
import com.linecorp.bot.oauth.model.IssueChannelAccessTokenResponse;
2827
import com.linecorp.bot.oauth.model.IssueShortLivedChannelAccessTokenResponse;
@@ -168,21 +167,10 @@ CompletableFuture<Result<VerifyChannelAccessTokenResponse>> verifyChannelToken(
168167
CompletableFuture<Result<VerifyChannelAccessTokenResponse>> verifyChannelTokenByJWT(
169168
@Query("access_token") String accessToken);
170169

171-
public static ApiAuthenticatedClientBuilder<ChannelAccessTokenClient> builder(
172-
String channelToken) {
173-
return new ApiAuthenticatedClientBuilder<>(
170+
public static ApiClientBuilder<ChannelAccessTokenClient> builder() {
171+
return new ApiClientBuilder<>(
174172
URI.create("https://api.line.me"),
175173
ChannelAccessTokenClient.class,
176-
new ChannelAccessTokenExceptionBuilder(),
177-
channelToken);
178-
}
179-
180-
public static ApiAuthenticatedClientBuilder<ChannelAccessTokenClient> builder(
181-
ChannelTokenSupplier channelTokenSupplier) {
182-
return new ApiAuthenticatedClientBuilder<>(
183-
URI.create("https://api.line.me"),
184-
ChannelAccessTokenClient.class,
185-
new ChannelAccessTokenExceptionBuilder(),
186-
channelTokenSupplier);
174+
new ChannelAccessTokenExceptionBuilder());
187175
}
188176
}

clients/line-channel-access-token-client/src/test/java/com/linecorp/bot/oauth/client/ChannelAccessTokenClientExTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public void setUp() {
6060
wireMockServer.start();
6161
WireMock.configureFor("localhost", wireMockServer.port());
6262

63-
target = ChannelAccessTokenClient.builder("MY_ACCESS_TOKEN")
63+
target = ChannelAccessTokenClient.builder()
6464
.apiEndPoint(URI.create(wireMockServer.baseUrl()))
6565
.build();
6666
}

clients/line-channel-access-token-client/src/test/java/com/linecorp/bot/oauth/client/ChannelAccessTokenClientTest.java

Lines changed: 0 additions & 231 deletions
This file was deleted.

generator/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@
100100
<artifactId>maven-compiler-plugin</artifactId>
101101
<version>3.11.0</version>
102102
<configuration>
103-
<source>1.8</source>
104-
<target>1.8</target>
103+
<source>9</source>
104+
<target>9</target>
105105
</configuration>
106106
</plugin>
107107
<plugin>

generator/src/main/resources/line-java-codegen/api.pebble

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{# @pebvariable name="package" type="java.lang.String" -#}
44
{# @pebvariable name="generatorClass" type="java.lang.String" -#}
55
{# @pebvariable name="classname" type="java.lang.String" -#}
6-
{# @pebvariable name="authenticated" type="java.lang.Boolean" -#}
6+
{# @pebvariable name="authMethods" type="java.util.ArrayList<org.openapitools.codegen.CodegenSecurity>" -#}
77
{% include "./licenseInfo.pebble" %}
88
package {{ package }};
99
{% import "./macros/api_param.pebble" %}
@@ -71,7 +71,7 @@ public interface {{classname}} {
7171

7272
{% endfor %}
7373

74-
{% if authenticated %}
74+
{% if authMethods != null %}
7575
public static ApiAuthenticatedClientBuilder<{{classname}}> builder(String channelToken) {
7676
return new ApiAuthenticatedClientBuilder<>(URI.create("{{ endpoint(classname) }}"), {{classname}}.class, new {{ exceptionbuilderclassname(classname) }}(), channelToken);
7777
}

generator/src/main/resources/line-java-codegen/api_test.pebble

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{# @pebvariable name="operations" type="org.openapitools.codegen.model.OperationMap" -#}
33
{# @pebvariable name="generatorClass" type="java.lang.String" -#}
44
{# @pebvariable name="classname" type="java.lang.String" -#}
5-
{# @pebvariable name="authenticated" type="boolean" -#}
5+
{# @pebvariable name="authMethods" type="java.util.ArrayList<org.openapitools.codegen.CodegenSecurity>" -#}
66
{% include "./licenseInfo.pebble" %}
77

88
package {# @pebvariable name="package" type="java.lang.String" -#}{{package}};
@@ -71,7 +71,7 @@ public class {{classname}}Test {
7171
configureFor("localhost", wireMockServer.port());
7272

7373

74-
api = {{classname}}.builder({% if authenticated %}"MY_OWN_TOKEN"{% endif %})
74+
api = {{classname}}.builder({% if authMethods != null %}"MY_OWN_TOKEN"{% endif %})
7575
.apiEndPoint(URI.create(wireMockServer.baseUrl()))
7676
.build();
7777
}

0 commit comments

Comments
 (0)