Skip to content

Commit

Permalink
fix: trim down unnecessary directives
Browse files Browse the repository at this point in the history
  • Loading branch information
pgautier404 committed Sep 11, 2023
1 parent 5ac68ab commit a8e2de6
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 26 deletions.
5 changes: 0 additions & 5 deletions src/Momento.Sdk/Auth/EnvMomentoTokenProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ public class EnvMomentoTokenProvider : ICredentialProvider
public string ControlEndpoint { get; private set; }
/// <inheritdoc />
public string CacheEndpoint { get; private set; }

#if !BUILD_FOR_UNITY
/// <inheritdoc />
public string TokenEndpoint { get; private set; }
#endif

/// <summary>
/// Reads and parses a JWT token stored as an environment variable.
Expand All @@ -44,9 +41,7 @@ public EnvMomentoTokenProvider(string name)
var tokenData = AuthUtils.TryDecodeAuthToken(AuthToken);
ControlEndpoint = tokenData.ControlEndpoint;
CacheEndpoint = tokenData.CacheEndpoint;
#if !BUILD_FOR_UNITY
TokenEndpoint = tokenData.TokenEndpoint;
#endif
AuthToken = tokenData.AuthToken;
}

Expand Down
3 changes: 0 additions & 3 deletions src/Momento.Sdk/Auth/ICredentialProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@ public interface ICredentialProvider
/// The host which the Momento client will connect to the Momento data plane
/// </summary>
string CacheEndpoint { get; }

#if !BUILD_FOR_UNITY
/// <summary>
/// The host which the Momento client will connect to the token endpoint
/// </summary>
string TokenEndpoint { get; }
#endif

/// <summary>
/// Copy constructor to override the CacheEndpoint
Expand Down
5 changes: 0 additions & 5 deletions src/Momento.Sdk/Auth/StringMomentoTokenProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ public class StringMomentoTokenProvider : ICredentialProvider
public string ControlEndpoint { get; private set; }
/// <inheritdoc />
public string CacheEndpoint { get; private set; }

#if !BUILD_FOR_UNITY
/// <inheritdoc />
public string TokenEndpoint { get; private set; }
#endif

/// <summary>
/// Reads and parses a JWT token from a string.
Expand All @@ -39,9 +36,7 @@ public StringMomentoTokenProvider(string token)
var tokenData = AuthUtils.TryDecodeAuthToken(AuthToken);
ControlEndpoint = tokenData.ControlEndpoint;
CacheEndpoint = tokenData.CacheEndpoint;
#if !BUILD_FOR_UNITY
TokenEndpoint = tokenData.TokenEndpoint;
#endif
AuthToken = tokenData.AuthToken;
}

Expand Down
9 changes: 0 additions & 9 deletions src/Momento.Sdk/Auth/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,14 @@ internal class TokenAndEndpoints
public string AuthToken { get; }
public string ControlEndpoint { get; }
public string CacheEndpoint { get; }

#if !BUILD_FOR_UNITY
public string TokenEndpoint { get; }
#endif

public TokenAndEndpoints(string authToken, string controlEndpoint, string cacheEndpoint, string tokenEndpoint)
{
AuthToken = authToken;
ControlEndpoint = controlEndpoint;
CacheEndpoint = cacheEndpoint;
#if !BUILD_FOR_UNITY
TokenEndpoint = tokenEndpoint;
#endif
}
}

Expand Down Expand Up @@ -64,9 +59,7 @@ public static TokenAndEndpoints TryDecodeAuthToken(string authToken)
decodedToken.api_key!,
"control." + decodedToken.endpoint,
"cache." + decodedToken.endpoint,
#if !BUILD_FOR_UNITY
"token." + decodedToken.endpoint
#endif
);
}
else
Expand All @@ -76,9 +69,7 @@ public static TokenAndEndpoints TryDecodeAuthToken(string authToken)
authToken,
claims.ControlEndpoint,
claims.CacheEndpoint,
#if !BUILD_FOR_UNITY
claims.CacheEndpoint
#endif
);
}
}
Expand Down
4 changes: 0 additions & 4 deletions src/Momento.Sdk/Internal/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
using System.Linq;
using System.Text;

#if !BUILD_FOR_UNITY
using Momento.Sdk.Exceptions;
#endif

namespace Momento.Sdk.Internal;

Expand Down Expand Up @@ -105,7 +103,6 @@ public static void ArgumentStrictlyPositive(int? argument, string paramName)
}
}

#if !BUILD_FOR_UNITY
/// <summary>
/// Throw an exception if the supplied ExpiresIn object is invalid.
/// </summary>
Expand All @@ -126,7 +123,6 @@ public static void CheckValidDisposableTokenExpiry(ExpiresIn expiresIn)
throw new InvalidArgumentException("Disposable token must expire within 1 hour");
}
}
#endif

/// <summary>
/// Defines methods to support comparing containers of reference items by their
Expand Down

0 comments on commit a8e2de6

Please sign in to comment.