Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added force logout on CVAT app start if token is missing #5331

Merged
merged 4 commits into from
Nov 23, 2022

Conversation

klakhov
Copy link
Contributor

@klakhov klakhov commented Nov 21, 2022

Motivation and context

Before merging this, need to fix getting token from server during social authentication

Sometimes login token can be missing in our browser(cleared local storage). In cvat we use two different types of authentication, so most operations will work good without token(but not all of them). In the future we can implement only one type of authentication, but for now lets force app to keep two methods of authentication.

We run authorized function when app is starting, here we make request about current user. If it fails with 401 cookies will be automatically reset by server, and then we clear token. If it goes well, then we can be sure that we have correct auth cookies. So then we check token and if its missing, we forcibly logging out a user.

How has this been tested?

Checklist

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.

@bsekachev
Copy link
Member

I am not sure it solves the issue with 3rd party authentification.
After authentification via GitHub I do not have token in local storage. So, I will automatically logout after updating a page..

@klakhov klakhov changed the title Added force logout on CVAT app start if token is missing [Dependent] Added force logout on CVAT app start if token is missing Nov 21, 2022
@nmanovic
Copy link
Contributor

@bsekachev , let's wait while @Marishka17 gives us a fix. It is expected tomorrow.

@nmanovic nmanovic changed the title [Dependent] Added force logout on CVAT app start if token is missing Added force logout on CVAT app start if token is missing Nov 23, 2022
@nmanovic
Copy link
Contributor

One failed tests because Cypress cannot be downloaded. I will merge the PR.

[FAILED] Platform: linux-x64 (Ubuntu - 20.04)
[FAILED] Cypress Version: 9.7.0
The Cypress App could not be downloaded.

Does your workplace require a proxy to be used to access the Internet? If so, you must configure the HTTP_PROXY environment variable before downloading Cypress. Read more: https://on.cypress.io/proxy-configuration

Otherwise, please check network connectivity and try again:

----------

URL: https://download.cypress.io/desktop/9.7.0?platform=linux&arch=x[64](https://github.com/opencv/cvat/actions/runs/3533987992/jobs/5930522631#step:10:65)
Error: Failed downloading the Cypress binary.
Response code: 524
Response message:

----------

Platform: linux-x64 (Ubuntu - 20.04)
Cypress Version: 9.7.0
Error: Process completed with exit code 1.

@nmanovic nmanovic merged commit 8705e23 into develop Nov 23, 2022
@nmanovic nmanovic deleted the kl/force-logout-if-token-empty branch November 23, 2022 17:24
@nmanovic nmanovic mentioned this pull request Dec 12, 2022
bsekachev pushed a commit that referenced this pull request Feb 17, 2023
<!-- Raised an issue to propose your change
(https://github.com/cvat-ai/cvat/issues).
It helps to avoid duplication of efforts from multiple independent
contributors.
Discuss your ideas with maintainers to be sure that changes will be
approved and merged.
Read the
[CONTRIBUTION](https://github.com/cvat-ai/cvat/blob/develop/CONTRIBUTING.md)
guide. -->

<!-- Provide a general summary of your changes in the Title above -->

### Motivation and context
<!-- Why is this change required? What problem does it solve? If it
fixes an open
issue, please link to the issue here. Describe your changes in detail,
add
screenshots. -->
Related #5331 
Added test, changed fix because of temporary solutions in #5344 
### How has this been tested?
<!-- Please describe in detail how you tested your changes.
Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc. -->

### Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply.
If an item isn't applicable by a reason then ~~explicitly
strikethrough~~ the whole
line. If you don't do that github will show an incorrect process for the
pull request.
If you're unsure about any of these, don't hesitate to ask. We're here
to help! -->
- [ ] I submit my changes into the `develop` branch
- [ ] I have added a description of my changes into
[CHANGELOG](https://github.com/cvat-ai/cvat/blob/develop/CHANGELOG.md)
file
- [ ] I have updated the [documentation](
https://github.com/cvat-ai/cvat/blob/develop/README.md#documentation)
accordingly
- [ ] I have added tests to cover my changes
- [ ] I have linked related issues ([read github docs](

https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword))
- [ ] I have increased versions of npm packages if it is necessary
([cvat-canvas](https://github.com/cvat-ai/cvat/tree/develop/cvat-canvas#versioning),

[cvat-core](https://github.com/cvat-ai/cvat/tree/develop/cvat-core#versioning),
[cvat-data](https://github.com/cvat-ai/cvat/tree/develop/cvat-data#versioning)
and
[cvat-ui](https://github.com/cvat-ai/cvat/tree/develop/cvat-ui#versioning))

### License

- [ ] I submit _my code changes_ under the same [MIT License](
https://github.com/cvat-ai/cvat/blob/develop/LICENSE) that covers the
project.
  Feel free to contact the maintainers if that's a concern.

---------

Co-authored-by: Maya <maya17grd@gmail.com>
mikhail-treskin pushed a commit to retailnext/cvat that referenced this pull request Jul 1, 2023
<!-- Raised an issue to propose your change
(https://github.com/cvat-ai/cvat/issues).
It helps to avoid duplication of efforts from multiple independent
contributors.
Discuss your ideas with maintainers to be sure that changes will be
approved and merged.
Read the
[CONTRIBUTION](https://github.com/cvat-ai/cvat/blob/develop/CONTRIBUTING.md)
guide. -->

<!-- Provide a general summary of your changes in the Title above -->

### Motivation and context
<!-- Why is this change required? What problem does it solve? If it
fixes an open
issue, please link to the issue here. Describe your changes in detail,
add
screenshots. -->
Related cvat-ai#5331 
Added test, changed fix because of temporary solutions in cvat-ai#5344 
### How has this been tested?
<!-- Please describe in detail how you tested your changes.
Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc. -->

### Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply.
If an item isn't applicable by a reason then ~~explicitly
strikethrough~~ the whole
line. If you don't do that github will show an incorrect process for the
pull request.
If you're unsure about any of these, don't hesitate to ask. We're here
to help! -->
- [ ] I submit my changes into the `develop` branch
- [ ] I have added a description of my changes into
[CHANGELOG](https://github.com/cvat-ai/cvat/blob/develop/CHANGELOG.md)
file
- [ ] I have updated the [documentation](
https://github.com/cvat-ai/cvat/blob/develop/README.md#documentation)
accordingly
- [ ] I have added tests to cover my changes
- [ ] I have linked related issues ([read github docs](

https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword))
- [ ] I have increased versions of npm packages if it is necessary
([cvat-canvas](https://github.com/cvat-ai/cvat/tree/develop/cvat-canvas#versioning),

[cvat-core](https://github.com/cvat-ai/cvat/tree/develop/cvat-core#versioning),
[cvat-data](https://github.com/cvat-ai/cvat/tree/develop/cvat-data#versioning)
and
[cvat-ui](https://github.com/cvat-ai/cvat/tree/develop/cvat-ui#versioning))

### License

- [ ] I submit _my code changes_ under the same [MIT License](
https://github.com/cvat-ai/cvat/blob/develop/LICENSE) that covers the
project.
  Feel free to contact the maintainers if that's a concern.

---------

Co-authored-by: Maya <maya17grd@gmail.com>
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