Skip to content

Commit 538aafc

Browse files
authored
NIFI-14468 Fixed scope property name AccessToken (#9871)
Signed-off-by: David Handermann <[email protected]>
1 parent 9a88aab commit 538aafc

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

nifi-extension-bundles/nifi-standard-services/nifi-oauth2-provider-api/src/main/java/org/apache/nifi/oauth2/AccessToken.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,21 @@ public class AccessToken {
2424
private String refreshToken;
2525
private String tokenType;
2626
private long expiresIn;
27-
private String scopes;
27+
private String scope;
2828

2929
private final Instant fetchTime;
3030

3131
public AccessToken() {
3232
this.fetchTime = Instant.now();
3333
}
3434

35-
public AccessToken(String accessToken, String refreshToken, String tokenType, long expiresIn, String scopes) {
35+
public AccessToken(String accessToken, String refreshToken, String tokenType, long expiresIn, String scope) {
3636
this();
3737
this.accessToken = accessToken;
3838
this.refreshToken = refreshToken;
3939
this.tokenType = tokenType;
4040
this.expiresIn = expiresIn;
41-
this.scopes = scopes;
41+
this.scope = scope;
4242
}
4343

4444
public String getAccessToken() {
@@ -73,12 +73,12 @@ public void setExpiresIn(long expiresIn) {
7373
this.expiresIn = expiresIn;
7474
}
7575

76-
public String getScopes() {
77-
return scopes;
76+
public String getScope() {
77+
return scope;
7878
}
7979

80-
public void setScopes(String scopes) {
81-
this.scopes = scopes;
80+
public void setScope(String scope) {
81+
this.scope = scope;
8282
}
8383

8484
public Instant getFetchTime() {

nifi-extension-bundles/nifi-standard-services/nifi-oauth2-provider-bundle/nifi-oauth2-provider-service/src/test/java/org/apache/nifi/oauth2/StandardOauth2AccessTokenProviderTest.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -274,20 +274,22 @@ public void testValidWhenClientAuthenticationStrategyIsValid() throws Exception
274274
@Test
275275
public void testAcquireNewToken() throws Exception {
276276
String accessTokenValue = "access_token_value";
277+
String scopeValue = "scope_value";
277278

278279
// GIVEN
279280
Response response = buildResponse(
280281
HTTP_OK,
281-
"{ \"access_token\":\"" + accessTokenValue + "\" }"
282+
"{ \"access_token\":\"" + accessTokenValue + "\", \"scope\":\"" + scopeValue + "\" }"
282283
);
283284

284285
when(mockHttpClient.newCall(any(Request.class)).execute()).thenReturn(response);
285286

286287
// WHEN
287-
String actual = testSubject.getAccessDetails().getAccessToken();
288+
AccessToken accessToken = testSubject.getAccessDetails();
288289

289290
// THEN
290-
assertEquals(accessTokenValue, actual);
291+
assertEquals(accessTokenValue, accessToken.getAccessToken());
292+
assertEquals(scopeValue, accessToken.getScope());
291293
}
292294

293295
@Test

0 commit comments

Comments
 (0)