Commit Graph

12 Commits

Author SHA1 Message Date
Arve Knudsen
4dd7b7a82d
Chore: Remove unused Go code (#28852)
* Chore: Remove more unused Go code

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-17 11:51:31 +01:00
Arve Knudsen
3d3a7cbba8
Chore: Fix staticcheck issues (#28860)
* Chore: Fix issues reported by staticcheck

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* Undo changes

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* Chore: Fix issues reported by staticcheck

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* Fix test

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* Fix test

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-05 13:07:06 +01:00
Sofia Papagiannaki
d1c523838b
API: Optionally list expired keys (#20468)
* API: Optionally list expired keys

* Update docs
2019-11-20 13:14:57 +02:00
Anthony Templeton
3680b95b44 Auth: Duplicate API Key Name Handle With Useful HTTP Code (#17905)
* API: Duplicate API Key Name Handle With Useful HTTP Code

* 17447: make changes requested during review

- use dialect.IsUniqueContraintViolation
- change if statement to match others
- return error properly

* Revert "17447: make changes requested during review"

This reverts commit a4a674ea83.

* API: useful http code on duplicate api key error w/ tests

* API: API Key Duplicate Handling

fixed small typo associated with error
2019-07-11 11:20:34 +03:00
Sofia Papagiannaki
dc9ec7dc91
Auth: Allow expiration of API keys (#17678)
* Modify backend to allow expiration of API Keys

* Add middleware test for expired api keys

* Modify frontend to enable expiration of API Keys

* Fix frontend tests

* Fix migration and add index for `expires` field

* Add api key tests for database access

* Substitude time.Now() by a mock for test usage

* Front-end modifications

* Change input label to `Time to live`
* Change input behavior to comply with the other similar
* Add tooltip

* Modify AddApiKey api call response

Expiration should be *time.Time instead of string

* Present expiration date in the selected timezone

* Use kbn for transforming intervals to seconds

* Use `assert` library for tests

* Frontend fixes

Add checks for empty/undefined/null values

* Change expires column from datetime to integer

* Restrict api key duration input

It should be interval not number

* AddApiKey must complain if SecondsToLive is negative

* Declare ErrInvalidApiKeyExpiration

* Move configuration to auth section

* Update docs

* Eliminate alias for models in modified files

* Omit expiration from api response if empty

* Eliminate Goconvey from test file

* Fix test

Do not sleep, use mocked timeNow() instead

* Remove index for expires from api_key table

The index should be anyway on both org_id and expires fields.
However this commit eliminates completely the index for now
since not many rows are expected to be in this table.

* Use getTimeZone function

* Minor change in api key listing

The frontend should display a message instead of empty string
if the key does not expire.
2019-06-26 09:47:03 +03:00
Torkel Ödegaard
059db533d5 HTTP API: grafana /render calls nows with api keys, Fixes #1649 2015-04-08 08:59:12 +02:00
Torkel Ödegaard
c75aa23092 New implementation for API Keys that only stores hashed api keys, and the client key is base64 decoded json web token with the unhashed key, Closes #1440 2015-02-26 17:23:28 +01:00
Torkel Ödegaard
6a2a6afc1d Merge branch 'develop' into apikey_hashed
Conflicts:
	pkg/api/apikey.go
	pkg/services/sqlstore/migrations.go
2015-02-26 15:48:54 +01:00
Torkel Ödegaard
26e4809e2e Big Backend Refatoring: Renamed Account -> Org 2015-02-23 20:07:49 +01:00
Torkel Ödegaard
5269422f7c Began work on hashing api keys 2015-02-09 13:30:04 +01:00
Torkel Ödegaard
23bbc5160e Fixed validation for adding api keys, added unique index for api key name + account_id 2015-02-07 13:11:39 +01:00
Torkel Ödegaard
951ce0a102 API token -> API key rename 2015-01-27 08:26:11 +01:00