23 lines
477 B
Go
23 lines
477 B
Go
package auth
|
|
|
|
import (
|
|
"sync"
|
|
)
|
|
|
|
var callbackRedirectMap map[string]string = make(map[string]string, 5)
|
|
var callbackRedirectMutex sync.Mutex
|
|
|
|
func AddRedirect(state, url string) {
|
|
callbackRedirectMutex.Lock()
|
|
callbackRedirectMap[state] = url
|
|
callbackRedirectMutex.Unlock()
|
|
}
|
|
|
|
func GetRedirect(state string) string {
|
|
callbackRedirectMutex.Lock()
|
|
redirect := callbackRedirectMap[state]
|
|
delete(callbackRedirectMap, state)
|
|
callbackRedirectMutex.Unlock()
|
|
return redirect
|
|
}
|