mirror of
https://github.com/kataras/iris.git
synced 2025-12-23 12:57:05 +00:00
add context partial user helper and accept a generic interface on SetUser - the same method now returns an error if the given value does not complete at least one method of the User interface
This commit is contained in:
@@ -26,7 +26,11 @@ func TestBasicAuthUseRouter(t *testing.T) {
|
||||
|
||||
app.Get("/user_string", func(ctx iris.Context) {
|
||||
user := ctx.User()
|
||||
ctx.Writef("%s\n%s\n%s", user.GetAuthorization(), user.GetUsername(), user.GetPassword())
|
||||
|
||||
authorization, _ := user.GetAuthorization()
|
||||
username, _ := user.GetUsername()
|
||||
password, _ := user.GetPassword()
|
||||
ctx.Writef("%s\n%s\n%s", authorization, username, password)
|
||||
})
|
||||
|
||||
app.Get("/", func(ctx iris.Context) {
|
||||
|
||||
Reference in New Issue
Block a user