DependencyTrack / DependencyTrack/frontend
Seamless log in using url variable
- Dominant language
- Vue
- Stars
- 171
- Forks
- 250
- Avg merge
- 10h 56m
- Merged PRs (30d)
- 84
Description
### Current Behavior
Existing API provides endpoints to automatically manage and log in users (request JWT token), but frontend does not have a way to authoritatively redirect or simply link user to any part of the interface with their credentials (token) already entered.
### Proposed Behavior
Why: You can imagine a simple web page with a list of repositories and each of them having a button to open corresponding project dashboard. The easiest solution here is to read passed token in the url variable and save it, avoiding log in form.
I tested this, because I need and will use this, but wouldn't want to maintain custom fork just to have this functionality.
This is a simple code change (although I haven't thoroughly looked through the code, so there might be unknown impacts).
Change (`/src/shared/permissions.js` file):
```js
+ import { getUrlVar } from './utils';
...
export const getToken = function getToken() {
+ // @TODO: Clean up url after extracting token value.
+ const token = getUrlVar("token");
+ if (token) {
+ sessionStorage.setItem("token", token);
+ return token;
+ }
return sessionStorage.getItem("token");
};
```
### Checklist
- [X] I have read and understand the [contributing guidelines](https://github.com/DependencyTrack/dependency-track/blob/master/CONTRIBUTING.md#filing-issues)
- [X] I have checked the [existing issues](https://github.com/DependencyTrack/frontend/issues) for whether this enhancement was already requested
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in /src/shared/permissions.js at getToken and inspect the getUrlVar helper in ./utils. Confirm how a token supplied through the URL should be stored and whether the URL cleanup noted in the issue is required. Done means the frontend can use the supplied token for authentication without requiring the login form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- authentication, frontend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100