Reverse proxy authentication support (#1152)

* feat(auth): reverse proxy authentication support - #176

* address PR remarks

* Fix redaction of UI appConfig

Co-authored-by: Deluan <deluan@navidrome.org>
This commit is contained in:
Igor Rzegocki
2021-06-12 03:17:21 +00:00
committed by GitHub
parent b445cdd641
commit 6bd4c0f6bf
8 changed files with 216 additions and 3 deletions
+16
View File
@@ -5,6 +5,22 @@ import { baseUrl } from './utils'
import config from './config'
import { startEventStream, stopEventStream } from './eventStream'
if (config.auth) {
try {
jwtDecode(config.auth.token)
localStorage.setItem('token', config.auth.token)
localStorage.setItem('userId', config.auth.id)
localStorage.setItem('name', config.auth.name)
localStorage.setItem('username', config.auth.username)
config.auth.avatar && config.auth.setItem('avatar', config.auth.avatar)
localStorage.setItem('role', config.auth.isAdmin ? 'admin' : 'regular')
localStorage.setItem('subsonic-salt', config.auth.subsonicSalt)
localStorage.setItem('subsonic-token', config.auth.subsonicToken)
} catch (e) {
console.log(e)
}
}
const authProvider = {
login: ({ username, password }) => {
let url = baseUrl('/app/login')