File tree Expand file tree Collapse file tree
s2a/src/main/java/io/grpc/s2a/handshaker Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,27 +33,23 @@ final class GetAuthenticationMechanisms {
3333 * @return an {@link AuthenticationMechanism} for the given local identity.
3434 */
3535 static Optional <AuthenticationMechanism > getAuthMechanism (Optional <S2AIdentity > localIdentity ) {
36- Optional <AuthenticationMechanism > authMechanism = Optional .empty ();
3736 if (!TOKEN_MANAGER .isPresent ()) {
3837 return Optional .empty ();
3938 }
4039 AccessTokenManager manager = TOKEN_MANAGER .get ();
4140 // If no identity is provided, fetch the default access token and DO NOT attach an identity
4241 // to the request.
4342 if (!localIdentity .isPresent ()) {
44- authMechanism =
45- Optional .of (
43+ return Optional .of (
4644 AuthenticationMechanism .newBuilder ().setToken (manager .getDefaultToken ()).build ());
4745 } else {
4846 // Fetch an access token for the provided identity.
49- authMechanism =
50- Optional .of (
47+ return Optional .of (
5148 AuthenticationMechanism .newBuilder ()
5249 .setIdentity (localIdentity .get ().getIdentity ())
5350 .setToken (manager .getToken (localIdentity .get ()))
5451 .build ());
5552 }
56- return authMechanism ;
5753 }
5854
5955 private GetAuthenticationMechanisms () {}
You can’t perform that action at this time.
0 commit comments