This shows you the differences between two versions of the page.
ii:labs:s2:03:tasks:02 [2022/05/06 11:37] radu.ciobanu [02. [10p] Running containers] |
ii:labs:s2:03:tasks:02 [2024/04/01 21:39] (current) florin.stancu created |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== 02. [10p] Running containers ==== | + | ==== 02. [30p] Mock Authentication ==== |
- | == Subtasks == | + | Now, it's the time to add authentication to our website. |
- | - pull the **//busybox//** image from the official Docker registry to the local cache | + | * Use a server-side ''session'' to store the user's state (e.g., an ''authenticated'' bool + ''username'' string keys). |
- | - run a **//busybox//** container that executes the **//uptime//** command | + | * Don't forget to set a ''secret_key'' for the session, otherwise it won't work! |
- | - run an interactive **//busybox//** container; once you enter it, run the command **//wget google.com//**, then exit | + | * Write the Flask functions for ''/login'' and ''/logout'' with the appropriate checks / actions. |
- | - run a **//busybox//** detached interactive container (daemon); once you have started it, attach to it and run the **//id//** command, then exit | + | * You can either use the included ''login.html'' template page, or roll out your own! |
- | - delete all containers and images created at the previous points | + | * Check out the input names inside the ''<form>''! |
+ | * Hint: you can also set the ''authenticated'' variable inside the Jinja template to conditionally display the user's status. | ||
+ | * You can use a Flask [[https://flask.palletsprojects.com/en/3.0.x/templating/#context-processors|context processor]] to avoid needless code duplication; | ||
+ | * //Alternative//: the ''session'' is readily available inside Jinja2 templates! | ||
- | == What to upload == | ||
- | * a text file with the executed commands |