@@ -14,7 +14,7 @@ import (
1414 "github.com/openshift/origin/pkg/oauthserver"
1515)
1616
17- type Server struct {
17+ type osinServer struct {
1818 config * osin.ServerConfig
1919 server * osin.Server
2020 authorize AuthorizeHandler
@@ -31,15 +31,15 @@ func (l Logger) Printf(format string, v ...interface{}) {
3131 }
3232}
3333
34- func New (config * osin.ServerConfig , storage osin.Storage , authorize AuthorizeHandler , access AccessHandler , errorHandler ErrorHandler ) * Server {
34+ func New (config * osin.ServerConfig , storage osin.Storage , authorize AuthorizeHandler , access AccessHandler , errorHandler ErrorHandler ) oauthserver. Endpoints {
3535 server := osin .NewServer (config , storage )
3636
3737 // Override tokengen to ensure we get valid length tokens
3838 server .AuthorizeTokenGen = TokenGen {}
3939 server .AccessTokenGen = TokenGen {}
4040 server .Logger = Logger {}
4141
42- return & Server {
42+ return & osinServer {
4343 config : config ,
4444 server : server ,
4545 authorize : authorize ,
@@ -48,17 +48,13 @@ func New(config *osin.ServerConfig, storage osin.Storage, authorize AuthorizeHan
4848 }
4949}
5050
51- // Install registers the Server OAuth handlers into a mux. It is expected that the
52- // provided prefix will serve all operations
53- func (s * Server ) Install (mux oauthserver.Mux , paths ... string ) {
54- for _ , prefix := range paths {
55- mux .HandleFunc (path .Join (prefix , urls .AuthorizePath ), s .handleAuthorize )
56- mux .HandleFunc (path .Join (prefix , urls .TokenPath ), s .handleToken )
57- mux .HandleFunc (path .Join (prefix , urls .InfoPath ), s .handleInfo )
58- }
51+ func (s * osinServer ) Install (mux oauthserver.Mux , prefix string ) {
52+ mux .HandleFunc (path .Join (prefix , urls .AuthorizePath ), s .handleAuthorize )
53+ mux .HandleFunc (path .Join (prefix , urls .TokenPath ), s .handleToken )
54+ mux .HandleFunc (path .Join (prefix , urls .InfoPath ), s .handleInfo )
5955}
6056
61- func (s * Server ) handleAuthorize (w http.ResponseWriter , r * http.Request ) {
57+ func (s * osinServer ) handleAuthorize (w http.ResponseWriter , r * http.Request ) {
6258 resp := s .server .NewResponse ()
6359 defer resp .Close ()
6460
@@ -97,7 +93,7 @@ func (s *Server) handleAuthorize(w http.ResponseWriter, r *http.Request) {
9793 osin .OutputJSON (resp , w , r )
9894}
9995
100- func (s * Server ) handleToken (w http.ResponseWriter , r * http.Request ) {
96+ func (s * osinServer ) handleToken (w http.ResponseWriter , r * http.Request ) {
10197 resp := s .server .NewResponse ()
10298 defer resp .Close ()
10399
@@ -114,7 +110,7 @@ func (s *Server) handleToken(w http.ResponseWriter, r *http.Request) {
114110 osin .OutputJSON (resp , w , r )
115111}
116112
117- func (s * Server ) handleInfo (w http.ResponseWriter , r * http.Request ) {
113+ func (s * osinServer ) handleInfo (w http.ResponseWriter , r * http.Request ) {
118114 resp := s .server .NewResponse ()
119115 defer resp .Close ()
120116
0 commit comments