Add deprecation warning for /device/token endpoint
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
This commit is contained in:
parent
1211a86d58
commit
9ed5cc00cf
@ -152,6 +152,9 @@ func (s *Server) handleDeviceCode(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) handleDeviceTokenGrant(w http.ResponseWriter, r *http.Request) {
|
func (s *Server) handleDeviceTokenGrant(w http.ResponseWriter, r *http.Request) {
|
||||||
|
s.logger.Warn(`Request to the deprecated "/device/token" endpoint was received.`)
|
||||||
|
s.logger.Warn(`The "/device/token" endpoint will be removed in a future release.`)
|
||||||
|
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
switch r.Method {
|
switch r.Method {
|
||||||
case http.MethodPost:
|
case http.MethodPost:
|
||||||
|
@ -320,7 +320,7 @@ func newServer(ctx context.Context, c Config, rotationStrategy rotationStrategy)
|
|||||||
handleFunc("/device", s.handleDeviceExchange)
|
handleFunc("/device", s.handleDeviceExchange)
|
||||||
handleFunc("/device/auth/verify_code", s.verifyUserCode)
|
handleFunc("/device/auth/verify_code", s.verifyUserCode)
|
||||||
handleFunc("/device/code", s.handleDeviceCode)
|
handleFunc("/device/code", s.handleDeviceCode)
|
||||||
// TODO(nabokihms): deprecate and remove this endpoint, use /token instead
|
// TODO(nabokihms): "/device/token" endpoint is deprecated, consider using /token endpoint instead
|
||||||
handleFunc("/device/token", s.handleDeviceTokenGrant)
|
handleFunc("/device/token", s.handleDeviceTokenGrant)
|
||||||
handleFunc(deviceCallbackURI, s.handleDeviceCallback)
|
handleFunc(deviceCallbackURI, s.handleDeviceCallback)
|
||||||
r.HandleFunc(path.Join(issuerURL.Path, "/callback"), func(w http.ResponseWriter, r *http.Request) {
|
r.HandleFunc(path.Join(issuerURL.Path, "/callback"), func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
Reference in New Issue
Block a user