View Javadoc
1   package com.guinetik.rr.auth;
2   
3   import com.guinetik.rr.http.RocketHeaders;
4   
5   /**
6    * Authentication strategy that performs no authentication.
7    *
8    * <p>This is the default strategy used when no authentication is configured.
9    * It does not add any authentication headers to requests.
10   *
11   * <h2>Usage</h2>
12   * <pre class="language-java"><code>
13   * // Explicitly create no-auth strategy
14   * AuthStrategy auth = AuthStrategyFactory.createNoAuth();
15   *
16   * // Or simply don't set an auth strategy (default behavior)
17   * RocketRestConfig config = RocketRestConfig.builder("https://public-api.example.com")
18   *     .build();  // Uses NoAuthStrategy by default
19   * </code></pre>
20   *
21   * @author guinetik &lt;guinetik@gmail.com&gt;
22   * @see AuthStrategy
23   * @see AuthStrategyFactory#createNoAuth()
24   * @since 1.0.0
25   */
26  public class NoAuthStrategy implements AuthStrategy {
27  
28      @Override
29      public AuthType getType() {
30          return AuthType.NONE;
31      }
32  
33      @Override
34      public RocketHeaders applyAuthHeaders(RocketHeaders headers) {
35          // No headers to apply
36          return headers;
37      }
38  
39      @Override
40      public boolean needsTokenRefresh() {
41          return false;
42      }
43  
44      @Override
45      public boolean refreshCredentials() {
46          // Nothing to refresh
47          return true;
48      }
49  }