Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Mar 06 2018 01:49

    aarondl on vcrazy

    Fully re-implement recover - A… (compare)

  • Mar 05 2018 22:51
    aarondl commented #119
  • Mar 05 2018 22:51
    aarondl closed #119
  • Mar 05 2018 22:51
    aarondl closed #143
  • Mar 05 2018 22:50
    aarondl closed #149
  • Mar 05 2018 22:50
    aarondl commented #149
  • Mar 05 2018 22:49
    aarondl commented #153
  • Mar 05 2018 22:46
    aarondl commented #155
  • Mar 05 2018 22:42
    aarondl closed #154
  • Mar 05 2018 22:42
    aarondl commented #154
  • Mar 05 2018 22:38
    aarondl closed #147
  • Mar 05 2018 22:38
    aarondl commented #147
  • Mar 05 2018 22:38
    aarondl closed #99
  • Mar 05 2018 22:37
    aarondl closed #139
  • Mar 05 2018 22:37
    aarondl closed #138
  • Mar 05 2018 22:37
    aarondl closed #133
  • Mar 05 2018 22:37
    aarondl closed #131
  • Mar 05 2018 22:37
    aarondl closed #132
  • Mar 05 2018 22:37
    aarondl closed #130
  • Mar 05 2018 22:37
    aarondl closed #129
Scott Simpson
@sasimpson
I did...I shall check if that is the case.
I have the MountPath set to '/auth' and the Handle('/auth', ab.NewRouter())
set
/auth/login and /auth/auth/login both return 404s
Scott Simpson
@sasimpson
trying to put the test code up on GitHub @jack-chung so you can see...
its very bare bones, I was going to iterate through each of my requirements adding on the things I wanted one at a time.
Scott Simpson
@sasimpson
when I run it through the debugger I don't ever see it getting to the routes its loading, even though it indicates its loading them...
Scott Simpson
@sasimpson
but at this point I'm ready to delete the code in my project and write my own login/logout stuff...I don't want to but I can't get this to work.
Jack
@jack-chung
Have you tried the authboss sample app? I started there and it worked very well for me. Its a very complete sample showing all features.
Scott Simpson
@sasimpson
yes, I'm working from that.
and have copied much of it.
but as I said, the auth routes don't even seem to be found.
Jack
@jack-chung
What authboss branch are you using?
The sample should work with gopkg.in/authboss.v1
So if you just straight up compile the sample app does it work? I have heard they are working on a v2 so maybe the code in master is no longer compatible.
Scott Simpson
@sasimpson
yeah its all v1.
yes the sample one works...
are the templates required or will it use default ones?
even when I added those it still won't find the endpoints.
Scott Simpson
@sasimpson
when I use mux.PathPrefix("/auth").Handler(ab.NewRouter()) I get a rowdy stack trace which none of my code is in...
but when I just use mux.Handle("/auth", ab.NewRouter()) I don't get the stack trace, but I get 404s.
Jack
@jack-chung
The "views" are needed for the temple's fake blog site only. The "ab_views" are really needed for authboss.
You got a stacktrace as soon as you execute
as soon as you execute that line? Or when you ListenAndServe?
Scott Simpson
@sasimpson
when I access /auth/login
Jack
@jack-chung
You accessed it by POST right?
Scott Simpson
@sasimpson
no.
I'd like to get the login form first...
Jack
@jack-chung
Right :) sorry I forgot about the plain authboss. I have heavily modified it and am using my own login form.
Scott Simpson
@sasimpson
yeah so now, I've got a lot of the code from the example in mine, but I can't seem to get the <authpath>/login to work, it just 404s.
seems like that path and the login handler should have been added to that?
it says it is...
Jack
@jack-chung
I can compile your code later and see. I'm just not with a computer now. I'd suggest starting with the sample app and slowly take things away to get to the form you want? Since the sample app Is working for you
Scott Simpson
@sasimpson
sounds like a plan.
Aaron L
@aarondl

@/all Hey everyone. I apologize for not being more responsive and answering questions. I wanted to tell everyone that I haven't been getting notifications here and don't think it's a good place to conduct conversations (this is due to how gitter treats primary e-mail addresses on github). If you'd like some help or want to discuss something for now, please use Github issues or this mailing list:
https://groups.google.com/a/volatile.tech/forum/#!forum/authboss

It's worth noting that authboss has now moved to the github.com/volatiletech and is no longer using gopkg.in, this will be apparent in the readme soon.

Lastly thanks to everyone whose been sticking along with this project so far, good things are on the horizon! If you want a real-time chatting solution let me know on the mailing list.

Irvan Ahadi
@irvana
Hello, do we have implementation of JWT in authboss?
danielpellon
@danielpellon
does anyone know a different example project using authboss? I am having troubles implementing it, and I cant tell what im doing wrong.
So I am using gorilla mux for routing and this is my code in main :
ab = SetupAuthboss(db)

    // http.Handle("/graphql", &relay.Handler{Schema: schema})
    // start a new router and server
    router := mux.NewRouter()
    authRouter := ab.Config.Core.Router
    router.Use(ab.LoadClientStateMiddleware)
    router.PathPrefix("/auth").Handler(http.StripPrefix("/auth", authRouter))
    router.HandleFunc("/test", test).Methods("GET")
    server := http.Server{
        Addr:    ":12345",
        Handler: router,
    }

    log.Fatal(server.ListenAndServe())
danielpellon
@danielpellon
then for my setupauthboss function:
// SetupAuthboss initializes the authentiation service using authboss
func SetupAuthboss(db *sql.DB) *authboss.Authboss {
    // Initialize Sessions and Cookies
    cookieStoreKey, _ := base64.StdEncoding.DecodeString(`NpEPi8pEjKVjLGJ6kYCS+VTCzi6BUuDzU0wrwXyf5uDPArtlofn2AG6aTMiPmN3C909rsEWMNqJqhIVPGP3Exg==`)
    sessionStoreKey, _ := base64.StdEncoding.DecodeString(`AbfYwmmt8UCwUuhd9qvfNA9UCuN1cVcKJN1ofbiky6xCyyBj20whe40rJa3Su0WOWLWcPpO1taqJdsEI/65+JA==`)
    sessionCookieName := "cookie_test"
    cookieStore := abclientstate.NewCookieStorer(cookieStoreKey, nil)
    sessionStore := abclientstate.NewSessionStorer(sessionCookieName, sessionStoreKey, nil)
    ab := authboss.New()

    ab.Config.Storage.Server = auth.NewUserStorer(db)
    ab.Config.Storage.SessionState = sessionStore
    ab.Config.Storage.CookieState = cookieStore

    ab.Config.Paths.Mount = "/auth"
    ab.Config.Paths.RootURL = "localhost:12345"
    // Set up defaults for basically everything besides the ViewRenderer/MailRenderer in the HTTP stack
    defaults.SetCore(&ab.Config, false, false)

    if err := ab.Init(); err != nil {
        panic(err)
    }

    return ab
}
Then for the server storer i made some mock functions:
func (u UserStorer) Load(ctx context.Context, key string) (authboss.User, error) {

    user := model.User{ID: 3, Email: "test@gmail.com", FirstName: ".t", LastName: "dog", DateOfBirth: "sdasdsa"}
    user.PutPID("3")
    return user, nil
}

func (u UserStorer) Save(ctx context.Context, user authboss.User) error {
    return nil
}
Here im not sure what save is supposed to do, since the comment on the example says it should never create a user, is it just supposed to update it?
and user has the following two methods:
// GetPID returns a user id as a string, and is required by authboss
func (u User) GetPID() string { return string(u.ID) }

// PutPID into user, required by authboss
func (u User) PutPID(id string) {
    i, _ := strconv.ParseInt(id, 10, 32)
    u.ID = int32(i)
}
and finally my test function for handling the route /test:
func test(w http.ResponseWriter, r *http.Request) {
    userInter, err := ab.LoadCurrentUser(&r)
    if userInter != nil && err == nil {
        userInter.(*model.User).PutPID("1")
    }

    if err != nil {
        println(err)
    }
    println(userInter.(*model.User).GetPID())
}
danielpellon
@danielpellon
now the code compiles fine and can serve other routes, but when i go to /test I get the following error
http: panic serving 172.18.0.1:54456: interface conversion: authboss.User is nil, not *model.User
which comes from this line: userInter.(*model.User).PutPID("1")
what am I missing here? Am I not loading the middleware correctly? how can I load a mock user?
Nassim Abedi
@nassimabedi
Hi all :) I 'd like use authboss as a SAS I want to know session should set in server side(I mean set CSRF and cookie in register and login action) or it is something in consumer side?