mirror of
https://github.com/kataras/iris.git
synced 2025-12-21 20:07:04 +00:00
move example flash-messages to sessions example folder and change httptest example with basicauth
Former-commit-id: 3c5f6c97629a2a6ae44e62f2900edd32c0329b50
This commit is contained in:
@@ -37,19 +37,19 @@ func main() {
|
||||
{
|
||||
//http://localhost:8080/admin
|
||||
needAuth.Get("/", func(ctx context.Context) {
|
||||
username := ctx.Values().GetString("mycustomkey") // the Contextkey from the authConfig
|
||||
ctx.Writef("Hello authenticated user: %s from: %s ", username, ctx.Path())
|
||||
username := ctx.Values().GetString("user") // the Contextkey from the authConfig
|
||||
ctx.Writef("Hello authenticated user: %s from: %s", username, ctx.Path())
|
||||
})
|
||||
// http://localhost:8080/admin/profile
|
||||
needAuth.Get("/profile", func(ctx context.Context) {
|
||||
username := ctx.Values().GetString("mycustomkey") // the Contextkey from the authConfig
|
||||
ctx.Writef("Hello authenticated user: %s from: %s ", username, ctx.Path())
|
||||
username := ctx.Values().GetString("user") // the Contextkey from the authConfig
|
||||
ctx.Writef("Hello authenticated user: %s from: % ", username, ctx.Path())
|
||||
})
|
||||
|
||||
// http://localhost:8080/admin/settings
|
||||
needAuth.Get("/settings", func(ctx context.Context) {
|
||||
username := authConfig.User(ctx) // shortcut for ctx.Values().GetString("mycustomkey")
|
||||
ctx.Writef("Hello authenticated user: %s from: %s ", username, ctx.Path())
|
||||
username := authConfig.User(ctx) // shortcut for ctx.Values().GetString("user")
|
||||
ctx.Writef("Hello authenticated user: %s from: %s", username, ctx.Path())
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user