1
0
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:
kataras
2017-06-10 05:00:18 +03:00
parent c4788ee4e8
commit dd26fbf26d
7 changed files with 76 additions and 47 deletions

View File

@@ -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())
})
}