Skip to content

Commit 1c3fedd

Browse files
committed
- reverts to public access modifiers because of android linting
1 parent 985b479 commit 1c3fedd

4 files changed

Lines changed: 21 additions & 26 deletions

File tree

‎src/main/java/com/microsoft/graph/authentication/AuthConstants.java‎

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.microsoft.graph.authentication;
2+
3+
/**
4+
* Internal only.
5+
* Constants in use for the authentication provider
6+
*/
7+
public class InternalAuthConstants {
8+
/** The bearer value for the authorization request header, contains a space */
9+
public static final String BEARER = "Bearer ";
10+
/** The authorization request header name */
11+
public static final String AUTHORIZATION_HEADER = "Authorization";
12+
}

‎src/main/java/com/microsoft/graph/authentication/TokenCredentialAuthProvider.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public TokenCredentialAuthProvider(@Nonnull final List<String> scopes, @Nonnull
8282
@Override
8383
public void authenticateRequest(@Nonnull final IHttpRequest request) throws AuthenticationException {
8484
if(ShouldAuthenticateRequest(request.getRequestUrl().toString())) {
85-
request.addHeader(AuthConstants.AUTHORIZATION_HEADER, AuthConstants.BEARER + getAccessToken());
85+
request.addHeader(InternalAuthConstants.AUTHORIZATION_HEADER, InternalAuthConstants.BEARER + getAccessToken());
8686
}
8787
}
8888

@@ -97,7 +97,7 @@ public void authenticateRequest(@Nonnull final IHttpRequest request) throws Auth
9797
public Request authenticateRequest(@Nonnull final Request request) throws AuthenticationException {
9898
if(ShouldAuthenticateRequest(request.url().toString())) {
9999
return request.newBuilder()
100-
.addHeader(AuthConstants.AUTHORIZATION_HEADER, AuthConstants.BEARER + getAccessToken())
100+
.addHeader(InternalAuthConstants.AUTHORIZATION_HEADER, InternalAuthConstants.BEARER + getAccessToken())
101101
.build();
102102
} else {
103103
return request;

‎src/test/java/com/microsoft/graph/authentication/TokenCredentialAuthProviderTest.java‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ public void TokenCredentialAuthProviderTestICoreAuthentication() throws Authenti
3636
final TokenCredentialAuthProvider authProvider = new TokenCredentialAuthProvider(mockCredential);
3737

3838
// Act
39-
Assert.assertNull(request.header(AuthConstants.AUTHORIZATION_HEADER));
39+
Assert.assertNull(request.header(InternalAuthConstants.AUTHORIZATION_HEADER));
4040
final Request authenticatedRequest = authProvider.authenticateRequest(request);
4141

4242
// Assert
4343
Assert.assertEquals(request.url(), authenticatedRequest.url());
44-
Assert.assertNotNull(authenticatedRequest.header(AuthConstants.AUTHORIZATION_HEADER));
45-
assertEquals(AuthConstants.BEARER + testToken, authenticatedRequest.header(AuthConstants.AUTHORIZATION_HEADER));
44+
Assert.assertNotNull(authenticatedRequest.header(InternalAuthConstants.AUTHORIZATION_HEADER));
45+
assertEquals(InternalAuthConstants.BEARER + testToken, authenticatedRequest.header(InternalAuthConstants.AUTHORIZATION_HEADER));
4646
}
4747

4848
@Test
@@ -71,8 +71,8 @@ public Void answer(InvocationOnMock invocation) throws Throwable {
7171
Assert.assertFalse(request.getHeaders().isEmpty());
7272

7373
//Assert
74-
Assert.assertTrue(request.getHeaders().get(0).getName().equals(AuthConstants.AUTHORIZATION_HEADER));
75-
Assert.assertTrue(request.getHeaders().get(0).getValue().equals(AuthConstants.BEARER + this.testToken));
74+
Assert.assertTrue(request.getHeaders().get(0).getName().equals(InternalAuthConstants.AUTHORIZATION_HEADER));
75+
Assert.assertTrue(request.getHeaders().get(0).getValue().equals(InternalAuthConstants.BEARER + this.testToken));
7676
}
7777
@Test
7878
public void TokenCredentialAuthProviderDoesNotAddTokenOnInvalidDomainsTestICoreAuthentication() throws AuthenticationException {
@@ -83,12 +83,12 @@ public void TokenCredentialAuthProviderDoesNotAddTokenOnInvalidDomainsTestICoreA
8383
final TokenCredentialAuthProvider authProvider = new TokenCredentialAuthProvider(mockCredential);
8484

8585
//Act
86-
Assert.assertNull(request.header(AuthConstants.AUTHORIZATION_HEADER));
86+
Assert.assertNull(request.header(InternalAuthConstants.AUTHORIZATION_HEADER));
8787
final Request authenticatedRequest = authProvider.authenticateRequest(request);
8888

8989
//Assert
9090
Assert.assertEquals(request.url(), authenticatedRequest.url());
91-
Assert.assertNull(authenticatedRequest.header(AuthConstants.AUTHORIZATION_HEADER));
91+
Assert.assertNull(authenticatedRequest.header(InternalAuthConstants.AUTHORIZATION_HEADER));
9292
}
9393

9494
@Test

0 commit comments

Comments
 (0)