Skip to content

Conversation

andresacg30
Copy link
Contributor

@andresacg30 andresacg30 commented Oct 31, 2022

The purpose of this Pull Request is to redirect the user when his access token expires.

How?

I merged the logic that was used in legacy. We subscribe to the login service, and it will unsubscribe if we try to make a request with an expired token. Also, in the token injector HTTP interceptor, I added a pipe that checks if the response is 401 unauthorized. If it is, it will redirect the user to the login page.

Files changed

  • Login component.ts for the logic mentioned above.
  • inject.token.interceptor.ts
  • Some files that were failing on the linting.

@github-actions
Copy link

[infrastructure/][stage] Terraform Plan 📖 success

Show Plan ```

terraform
module.ui.azurerm_app_service.this: Refreshing state... [id=/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-stage/providers/Microsoft.Web/sites/time-tracker-service-stage-ui]
module.ui.azurerm_app_service_custom_hostname_binding.this: Refreshing state... [id=/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-stage/providers/Microsoft.Web/sites/time-tracker-service-stage-ui/hostNameBindings/ui.timetrackerapp.stage.ioet.com]
module.ui.azurerm_dns_txt_record.this: Refreshing state... [id=/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-stage/providers/Microsoft.Network/dnszones/timetrackerapp.stage.ioet.com/TXT/asuid.ui.timetrackerapp.stage.ioet.com]
module.ui.azurerm_dns_cname_record.this: Refreshing state... [id=/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-stage/providers/Microsoft.Network/dnszones/timetrackerapp.stage.ioet.com/CNAME/ui]
module.ui.azurerm_app_service_managed_certificate.this: Refreshing state... [id=/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-stage/providers/Microsoft.Web/certificates/ui.timetrackerapp.stage.ioet.com]
module.ui.azurerm_app_service_certificate_binding.this: Refreshing state... [id=/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-stage/providers/Microsoft.Web/sites/time-tracker-service-stage-ui/hostNameBindings/ui.timetrackerapp.stage.ioet.com|/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-stage/providers/Microsoft.Web/certificates/ui.timetrackerapp.stage.ioet.com]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
~ update in-place

Terraform will perform the following actions:

module.ui.azurerm_app_service.this will be updated in-place

~ resource "azurerm_app_service" "this" {
id = "/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-stage/providers/Microsoft.Web/sites/time-tracker-service-stage-ui"
name = "time-tracker-service-stage-ui"
tags = {}
# (17 unchanged attributes hidden)

  ~ site_config {
      ~ linux_fx_version                     = (sensitive)
        # (29 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

    # (3 unchanged blocks hidden)
}

Plan: 0 to add, 1 to change, 0 to destroy.

─────────────────────────────────────────────────────────────────────────────

Note: You didn't use the -out option to save this plan, so Terraform can't
guarantee to take exactly these actions if you run "terraform apply" now.

</details>
*Pusher: @andresacg30, Action: `pull_request`*

@github-actions
Copy link

[infrastructure/][prod] Terraform Plan 📖 success

Show Plan ```

terraform
module.ui.azurerm_app_service.this: Refreshing state... [id=/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-prod/providers/Microsoft.Web/sites/time-tracker-service-prod-ui]
module.ui.azurerm_dns_cname_record.this: Refreshing state... [id=/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-prod/providers/Microsoft.Network/dnszones/timetrackerapp.ioet.com/CNAME/ui]
module.ui.azurerm_app_service_custom_hostname_binding.this: Refreshing state... [id=/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-prod/providers/Microsoft.Web/sites/time-tracker-service-prod-ui/hostNameBindings/ui.timetrackerapp.ioet.com]
module.ui.azurerm_dns_txt_record.this: Refreshing state... [id=/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-prod/providers/Microsoft.Network/dnszones/timetrackerapp.ioet.com/TXT/asuid.ui.timetrackerapp.ioet.com]
module.ui.azurerm_app_service_managed_certificate.this: Refreshing state... [id=/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-prod/providers/Microsoft.Web/certificates/ui.timetrackerapp.ioet.com]
module.ui.azurerm_app_service_certificate_binding.this: Refreshing state... [id=/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-prod/providers/Microsoft.Web/sites/time-tracker-service-prod-ui/hostNameBindings/ui.timetrackerapp.ioet.com|/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-prod/providers/Microsoft.Web/certificates/ui.timetrackerapp.ioet.com]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
~ update in-place

Terraform will perform the following actions:

module.ui.azurerm_app_service.this will be updated in-place

~ resource "azurerm_app_service" "this" {
id = "/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-prod/providers/Microsoft.Web/sites/time-tracker-service-prod-ui"
name = "time-tracker-service-prod-ui"
tags = {}
# (17 unchanged attributes hidden)

  ~ site_config {
      ~ linux_fx_version                     = (sensitive)
        # (29 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

    # (3 unchanged blocks hidden)
}

Plan: 0 to add, 1 to change, 0 to destroy.

─────────────────────────────────────────────────────────────────────────────

Note: You didn't use the -out option to save this plan, so Terraform can't
guarantee to take exactly these actions if you run "terraform apply" now.

</details>
*Pusher: @andresacg30, Action: `pull_request`*

@@ -64,15 +64,12 @@ export class LoginComponent implements OnInit {
ngOnInit() {

this.googleAuthSDK();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviisale si esta linea no te da conflictos porque es del Auth de google

@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 2, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@github-actions
Copy link

github-actions bot commented Nov 2, 2022

[infrastructure/][stage] Terraform Plan 📖 success

Show Plan ```

terraform
module.ui.azurerm_app_service.this: Refreshing state... [id=/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-stage/providers/Microsoft.Web/sites/time-tracker-service-stage-ui]
module.ui.azurerm_dns_cname_record.this: Refreshing state... [id=/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-stage/providers/Microsoft.Network/dnszones/timetrackerapp.stage.ioet.com/CNAME/ui]
module.ui.azurerm_dns_txt_record.this: Refreshing state... [id=/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-stage/providers/Microsoft.Network/dnszones/timetrackerapp.stage.ioet.com/TXT/asuid.ui.timetrackerapp.stage.ioet.com]
module.ui.azurerm_app_service_custom_hostname_binding.this: Refreshing state... [id=/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-stage/providers/Microsoft.Web/sites/time-tracker-service-stage-ui/hostNameBindings/ui.timetrackerapp.stage.ioet.com]
module.ui.azurerm_app_service_managed_certificate.this: Refreshing state... [id=/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-stage/providers/Microsoft.Web/certificates/ui.timetrackerapp.stage.ioet.com]
module.ui.azurerm_app_service_certificate_binding.this: Refreshing state... [id=/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-stage/providers/Microsoft.Web/sites/time-tracker-service-stage-ui/hostNameBindings/ui.timetrackerapp.stage.ioet.com|/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-stage/providers/Microsoft.Web/certificates/ui.timetrackerapp.stage.ioet.com]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
~ update in-place

Terraform will perform the following actions:

module.ui.azurerm_app_service.this will be updated in-place

~ resource "azurerm_app_service" "this" {
id = "/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-stage/providers/Microsoft.Web/sites/time-tracker-service-stage-ui"
name = "time-tracker-service-stage-ui"
tags = {}
# (17 unchanged attributes hidden)

  ~ site_config {
      ~ linux_fx_version                     = (sensitive)
        # (29 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

    # (3 unchanged blocks hidden)
}

Plan: 0 to add, 1 to change, 0 to destroy.

─────────────────────────────────────────────────────────────────────────────

Note: You didn't use the -out option to save this plan, so Terraform can't
guarantee to take exactly these actions if you run "terraform apply" now.

</details>
*Pusher: @andresacg30, Action: `pull_request`*

@github-actions
Copy link

github-actions bot commented Nov 2, 2022

[infrastructure/][prod] Terraform Plan 📖 success

Show Plan ```

terraform
module.ui.azurerm_app_service.this: Refreshing state... [id=/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-prod/providers/Microsoft.Web/sites/time-tracker-service-prod-ui]
module.ui.azurerm_app_service_custom_hostname_binding.this: Refreshing state... [id=/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-prod/providers/Microsoft.Web/sites/time-tracker-service-prod-ui/hostNameBindings/ui.timetrackerapp.ioet.com]
module.ui.azurerm_dns_cname_record.this: Refreshing state... [id=/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-prod/providers/Microsoft.Network/dnszones/timetrackerapp.ioet.com/CNAME/ui]
module.ui.azurerm_dns_txt_record.this: Refreshing state... [id=/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-prod/providers/Microsoft.Network/dnszones/timetrackerapp.ioet.com/TXT/asuid.ui.timetrackerapp.ioet.com]
module.ui.azurerm_app_service_managed_certificate.this: Refreshing state... [id=/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-prod/providers/Microsoft.Web/certificates/ui.timetrackerapp.ioet.com]
module.ui.azurerm_app_service_certificate_binding.this: Refreshing state... [id=/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-prod/providers/Microsoft.Web/sites/time-tracker-service-prod-ui/hostNameBindings/ui.timetrackerapp.ioet.com|/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-prod/providers/Microsoft.Web/certificates/ui.timetrackerapp.ioet.com]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
~ update in-place

Terraform will perform the following actions:

module.ui.azurerm_app_service.this will be updated in-place

~ resource "azurerm_app_service" "this" {
id = "/subscriptions/ca70c44c-ad7a-4333-a22c-07ebc6a69224/resourceGroups/time-tracker-service-prod/providers/Microsoft.Web/sites/time-tracker-service-prod-ui"
name = "time-tracker-service-prod-ui"
tags = {}
# (17 unchanged attributes hidden)

  ~ site_config {
      ~ linux_fx_version                     = (sensitive)
        # (29 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

    # (3 unchanged blocks hidden)
}

Plan: 0 to add, 1 to change, 0 to destroy.

─────────────────────────────────────────────────────────────────────────────

Note: You didn't use the -out option to save this plan, so Terraform can't
guarantee to take exactly these actions if you run "terraform apply" now.

</details>
*Pusher: @andresacg30, Action: `pull_request`*

@mmaquina mmaquina merged commit 90a1cca into master Nov 3, 2022
@mmaquina mmaquina deleted the TTA-209-adjust-the-token-expiration-time-w-o-auth-integration branch November 3, 2022 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants