Hi,
Yes this make sense and it works. The code also look simple to read.
Thanks!!
On Thursday, April 4, 2019 at 7:54:27 PM UTC+3, car...@hotmail.com wrote:
>
> How about something like this? Unsure about concurrent access to global
> variables, but if you want to access srv and clientstore fro
On Thu, Apr 4, 2019 at 2:44 AM wrote:
>
> I have modify the middleware to the below but it only work if the handler
> function "/protected" is in the main function.
> I have many handlers and do not want to put all of them in the main.go.
> You suggest i define a struct and use member function of
On Thu, Apr 4, 2019 at 1:46 AM wrote:
>
> changing and using "router.Use(getTokenMW(server))" is validating all the
> routes. How can i exclude routes
> /oauth2/token and /credentials. I read that populate but i dont get the idea.
> Any clew about how to go about this?
You can use subrouters:
s
How about something like this? Unsure about concurrent access to global
variables, but if you want to access srv and clientstore from package sw,
It'd make sense to me to move srv and clientstore out of main and into a
package.
howToApplyMiddleware
main.go
- server
server.go
- sw
handler.go
ro
I have modify the middleware to the below but it only work if the handler
function "/protected" is in the main function.
I have many handlers and do not want to put all of them in the main.go.
You suggest i define a struct and use member function of the struct, can
you elaborate more about for m
changing and using "router.Use(getTokenMW(server))" is validating all the
routes. How can i exclude routes
/oauth2/token and /credentials. I read that populate but i dont get the
idea.
Any clew about how to go about this?
On Wednesday, April 3, 2019 at 6:47:12 PM UTC+3, Burak Serdar wrote:
>
>
On Wed, Apr 3, 2019 at 8:35 AM wrote:
> type Route struct {
> Namestring
> Method string
> Pattern string
> HandlerFunc http.HandlerFunc
> }
>
> type Routes []Route
>
> func NewRouter() *mux.Router {
> router := mux.NewRouter().StrictSlash(true)
> for _, r
Hi,
I have this main function in a main.go file inside the main directory
func main() {
log.Printf("Server started")
router := sw.NewRouter()
manager := manage.NewDefaultManager()
manager.SetAuthorizeCodeTokenCfg(manage.DefaultAuthorizeCodeTokenCfg)
manager.MustTokenStorage(s