diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index 83421cee..a7678ee9 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -1,11 +1,12 @@ -name: Lint Commit Messages -on: [ pull_request ] - -jobs: - commitlint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - uses: wagoid/commitlint-github-action@v4 +--- +name: Lint Commit Messages +on: [pull_request] + +jobs: + commitlint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: wagoid/commitlint-github-action@v4 diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 7fb543cb..0db68377 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -57,4 +57,5 @@ jobs: VALIDATE_ALL_CODEBASE: true DEFAULT_BRANCH: main GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - FILTER_REGEX_EXCLUDE: (.*src/Packages/Passport/Runtime/Assets/ThirdParty/.*|.*src/Packages/Passport/Runtime/Assets/Resources/Bundles/.*) \ No newline at end of file + FILTER_REGEX_EXCLUDE: (.*src/Packages/Passport/Runtime/Assets/ThirdParty/.*|.*src/Packages/Passport/Runtime/Assets/Resources/Bundles/.*) + VALIDATE_GITLEAKS: false \ No newline at end of file diff --git a/src/Packages/Passport/Runtime/Assets/Resources/index.js b/src/Packages/Passport/Runtime/Assets/Resources/index.js index e148c49d..97512457 100644 --- a/src/Packages/Passport/Runtime/Assets/Resources/index.js +++ b/src/Packages/Passport/Runtime/Assets/Resources/index.js @@ -1,4 +1,3 @@ -const clientId = "mjtCL8mt06BtbxSkp2vbrYStKWnXVZfo" // not required const scope = "openid offline_access profile email transact" const audience = "platform_api" const redirectUri = "https://localhost:3000/" // Not required @@ -30,7 +29,7 @@ const getPassportConfig = () => { baseConfig: new config.ImmutableConfiguration({ environment: config.Environment.SANDBOX, }), - clientId: clientId, + clientId: "NOT_REQUIRED", ...sharedConfigurationValues, }; }; diff --git a/src/Packages/Passport/Tests/Runtime/Scripts/Auth/AuthManagerTests.cs b/src/Packages/Passport/Tests/Runtime/Scripts/Auth/AuthManagerTests.cs index cc3e24a2..b567fe71 100644 --- a/src/Packages/Passport/Tests/Runtime/Scripts/Auth/AuthManagerTests.cs +++ b/src/Packages/Passport/Tests/Runtime/Scripts/Auth/AuthManagerTests.cs @@ -22,22 +22,22 @@ public class AuthManagerTests internal const string ACCESS_TOKEN = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9." + "eyJlbWFpbCI6ImRvbWluaWMubXVycmF5QGltbXV0YWJsZS5jb20iLCJvcmciOiJhNTdiMWYzZC1mYTU3LTRiNzgtODZkYy05ZDEyZDM1YjlhNj" + "giLCJldGhlcl9rZXkiOiIweGRlMDYzYmViNmNmNDhlNGMxOTcxYzc3N2M0OGY0NTU3MTA1MjU5ZWMiLCJzdGFya19rZXkiOiIweGM1NTYxZGU3" + - "Nzg4NTUxOTY0ZWQxMjI0Yzc2ZjQ5ZDk5ZmVjODkyOGQ1OWVkNTcwZTExZGIwYzk3ZGYwMTFmIiwidXNlcl9hZG1pbl9rZXkiOiIweGY4MjY4OT" + - "I0MWU3NTM1YjYyNTgyMmI4M2I1OWMxZDM3ZWUwOTBiZGMiLCJpc3MiOiJodHRwczovL2F1dGguaW1tdXRhYmxlLmNvbS8iLCJzdWIiOiJlbWFp" + - "bHw2NDJiN2Q0YWI5N2IzYWMyNDg3NzBlNTEiLCJhdWQiOlsicGxhdGZvcm1fYXBpIiwiaHR0cHM6Ly9wcm9kLmltbXV0YWJsZS5hdXRoMGFwcC" + + "Nzg4NTUxOTY0ZWQxMjI0Yzc2ZjQ5ZDk5ZmVjODkyOGQ1OWVkNTcwZTExZGIwYzk3ZGYwMTFmIiwidXNlcl9hZG1pbl9rZXkiOiIweGY4MjY4OT" + + "I0MWU3NTM1YjYyNTgyMmI4M2I1OWMxZDM3ZWUwOTBiZGMiLCJpc3MiOiJodHRwczovL2F1dGguaW1tdXRhYmxlLmNvbS8iLCJzdWIiOiJlbWFp" + + "bHw2NDJiN2Q0YWI5N2IzYWMyNDg3NzBlNTEiLCJhdWQiOlsicGxhdGZvcm1fYXBpIiwiaHR0cHM6Ly9wcm9kLmltbXV0YWJsZS5hdXRoMGFwcC" + "5jb20vdXNlcmluZm8iXSwiaWF0IjoxNjg2ODg5MDgwLCJleHAiOjE2ODY5NzU0ODAsImF6cCI6IlpKTDdKdmV0Y0RGQk5EbGdSczVvSm94dUFV" + "VWw2dVFqIiwic2NvcGUiOiJvcGVuaWQgcHJvZmlsZSBlbWFpbCB0cmFuc2FjdCBvZmZsaW5lX2FjY2VzcyJ9.aqFem4Pp0k91YWdYuxBo1wfCr" + "YAHy1Y1zIqof2GMQXd_mwhGBkHotUlgFAsOIQmvO6lQG5m3cHLR9zlEsFJ_2AJuJg3NTNnF0dEx12H5hx24_aN4qDga8Q9KNDdGc3x4LAxv48P" + "H-P6OcdMnpWekCUPAI3zZ9qWC1YWU9HaouQuBJNbUV8ujyooFGOP4YzejQf2Uyxz9wmzDiMS-e70BSmY8IPRR2A3QjOEo7oI3enqM_jylfbDo8" + "BsDRouDbwbZrMeX-rcJ_HBY5iZEdagVpcvOmfZCaad55MI_WJcXHrDMzmLqck1fd15Oklo7fajQtiG0ByINxTmm9_0YnEy02w"; internal const string REFRESH_TOKEN = "v1.NOQCr0kkmy0Cky_Doia8VgJdclSKOOOrkicjZ4NFeabS5J7xNct-oRwO2H65ua0mPOhzWfIf8lhxlM1sIUBqLoc"; - internal const string ID_TOKEN = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9.eyJk" + + internal const string ID_TOKEN = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9.eyJk" + "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eyJldGhlcl9rZXkiOiIweGRlMDYzYmViNmNmNDhlNGMxOTcxYzc3N2M0OGY0NTU3MTA1MjU5ZWMiLCJzdGFy" + "a19rZXkiOiIweGM1NTYxZGU3Nzg4NTUxOTY0ZWQxMjI0Yzc2ZjQ5ZDk5ZmVjODkyOGQ1OWVkNTcwZTExZGIwYzk3ZGYwMTFmIiwidXNlcl9hZG" + "1pbl9rZXkiOiIweGY4MjY4OTI0MWU3NTM1YjYyNTgyMmI4M2I1OWMxZDM3ZWUwOTBiZGMifSwibmlja25hbWUiOiJkb21pbmljLm11cnJheSIs" + "Im5hbWUiOiJkb21pbmljLm11cnJheUBpbW11dGFibGUuY29tIiwicGljdHVyZSI6Imh0dHBzOi8vcy5ncmF2YXRhci5jb20vYXZhdGFyL2NkOT" + @@ -58,18 +58,18 @@ public class AuthManagerTests #pragma warning disable CS8618 private AuthManager manager; private MockHttpMessageHandler httpMock; - private MockCredentialsManager credentialsManager; + private MockCredentialsManager credentialsManager; #pragma warning restore CS8618 - - [SetUp] + + [SetUp] public void Init() - { + { httpMock = new MockHttpMessageHandler(); credentialsManager = new MockCredentialsManager(); manager = new AuthManager(httpMock.ToHttpClient(), credentialsManager); } - private async void PrepareForConfirmCode() + private async void PrepareForConfirmCode() { credentialsManager.hasValidCredentials = false; credentialsManager.token = null; @@ -77,7 +77,7 @@ private async void PrepareForConfirmCode() _ = await manager.Login(); } - private void AddDeviceCodeResponse() + private void AddDeviceCodeResponse() { var deviceCodeResponse = new HttpResponseMessage(HttpStatusCode.OK) { @@ -136,8 +136,8 @@ public async Task Login_Success_UsingRefreshToken() Assert.AreEqual(request.Method, HttpMethod.Post); string stringContent = await request.Content.ReadAsStringAsync(); Assert.True(stringContent.Contains($"{KEY_REFRESH_TOKEN}={REFRESH_TOKEN}")); - } - + } + [Test] public async Task Login_Failed_GetDeviceCode() { @@ -146,11 +146,11 @@ public async Task Login_Failed_GetDeviceCode() var deviceCodeResponse = new HttpResponseMessage(HttpStatusCode.NotAcceptable); httpMock.Responses.Add(deviceCodeResponse); Exception? e = null; - try + try { var result = await manager.Login(); - } - catch (Exception exception) + } + catch (Exception exception) { e = exception; } @@ -230,11 +230,11 @@ public async Task ConfirmCode_Failed_PendingAndExpired() Assert.Null(manager.GetUser()); Exception? e = null; - try + try { var result = await manager.ConfirmCode(); - } - catch (Exception exception) + } + catch (Exception exception) { e = exception; Debug.Log("Exception: " + e); @@ -263,11 +263,11 @@ public async Task ConfirmCode_Failed_SlowDownAndAccessDenied() Assert.Null(manager.GetUser()); Exception? e = null; - try + try { var result = await manager.ConfirmCode(); - } - catch (Exception exception) + } + catch (Exception exception) { e = exception; Debug.Log("Exception: " + e); @@ -290,11 +290,11 @@ public async Task ConfirmCode_Failed_UnexpectedErrorCode() Assert.Null(manager.GetUser()); Exception? e = null; - try + try { var result = await manager.ConfirmCode(); - } - catch (Exception exception) + } + catch (Exception exception) { e = exception; Debug.Log("Exception: " + e); @@ -316,11 +316,11 @@ public async Task ConfirmCode_Failed_UnexpectedResponse() Assert.Null(manager.GetUser()); Exception? e = null; - try + try { var result = await manager.ConfirmCode(); - } - catch (Exception exception) + } + catch (Exception exception) { e = exception; Debug.Log("Exception: " + e); @@ -334,7 +334,7 @@ public void HasCredentialsSavedTest() { Assert.False(manager.HasCredentialsSaved()); - credentialsManager.token = new TokenResponse() + credentialsManager.token = new TokenResponse() { access_token = AuthManagerTests.ACCESS_TOKEN, refresh_token = AuthManagerTests.REFRESH_TOKEN, @@ -351,27 +351,27 @@ private string CreateErrorJsonString(string error) } } - internal class MockCredentialsManager : ICredentialsManager + internal class MockCredentialsManager : ICredentialsManager { public bool hasValidCredentials = false; public TokenResponse? token = null; - public void SaveCredentials(TokenResponse tokenResponse) + public void SaveCredentials(TokenResponse tokenResponse) { token = tokenResponse; } - public TokenResponse? GetCredentials() + public TokenResponse? GetCredentials() { return token; } - public bool HasValidCredentials() + public bool HasValidCredentials() { return hasValidCredentials; } - public void ClearCredentials() + public void ClearCredentials() { }