mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-05 22:48:27 +02:00
Use scoped tokens to load <audio> urls instead of JWT
This commit is contained in:
parent
13d28f7b0c
commit
ec8dfdb740
17 changed files with 265 additions and 39 deletions
|
@ -38,7 +38,6 @@ describe('store/auth', () => {
|
|||
const state = {
|
||||
username: 'dummy',
|
||||
token: 'dummy',
|
||||
tokenData: 'dummy',
|
||||
profile: 'dummy',
|
||||
availablePermissions: 'dummy'
|
||||
}
|
||||
|
@ -46,7 +45,6 @@ describe('store/auth', () => {
|
|||
expect(state.authenticated).to.equal(false)
|
||||
expect(state.username).to.equal(null)
|
||||
expect(state.token).to.equal(null)
|
||||
expect(state.tokenData).to.equal(null)
|
||||
expect(state.profile).to.equal(null)
|
||||
expect(state.availablePermissions).to.deep.equal({})
|
||||
})
|
||||
|
@ -54,24 +52,12 @@ describe('store/auth', () => {
|
|||
const state = {}
|
||||
store.mutations.token(state, null)
|
||||
expect(state.token).to.equal(null)
|
||||
expect(state.tokenData).to.deep.equal({})
|
||||
})
|
||||
it('token real', () => {
|
||||
// generated on http://kjur.github.io/jsjws/tool_jwt.html
|
||||
const state = {}
|
||||
let token = 'eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJpc3MiOiJodHRwczovL2p3dC1pZHAuZXhhbXBsZS5jb20iLCJzdWIiOiJtYWlsdG86bWlrZUBleGFtcGxlLmNvbSIsIm5iZiI6MTUxNTUzMzQyOSwiZXhwIjoxNTE1NTM3MDI5LCJpYXQiOjE1MTU1MzM0MjksImp0aSI6ImlkMTIzNDU2IiwidHlwIjoiaHR0cHM6Ly9leGFtcGxlLmNvbS9yZWdpc3RlciJ9.'
|
||||
let tokenData = {
|
||||
iss: 'https://jwt-idp.example.com',
|
||||
sub: 'mailto:mike@example.com',
|
||||
nbf: 1515533429,
|
||||
exp: 1515537029,
|
||||
iat: 1515533429,
|
||||
jti: 'id123456',
|
||||
typ: 'https://example.com/register'
|
||||
}
|
||||
store.mutations.token(state, token)
|
||||
expect(state.token).to.equal(token)
|
||||
expect(state.tokenData).to.deep.equal(tokenData)
|
||||
})
|
||||
it('permissions', () => {
|
||||
const state = { availablePermissions: {} }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue