You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adressing issues from @padiazg also adding small changes
to the lab11 like changing name from `clearHash` to `getHash`
and adding `python` `yml` and `bash` to the code snippets
Signed-off-by: Martin Dekov (VMware) <[email protected]>
Copy file name to clipboardExpand all lines: lab11.md
+17-13Lines changed: 17 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -4,11 +4,17 @@
4
4
5
5
Before starting this lab create a new folder
6
6
7
-
```
7
+
```bash
8
8
mkdir -p lab11 \
9
9
&&cd lab11
10
10
```
11
11
12
+
also make sure your `faas-cli` version is `0.7.4` or above with the following command:
13
+
14
+
```
15
+
$ faas-cli version
16
+
```
17
+
12
18
## What is HMAC
13
19
14
20
Without any form of authentication or trust our functions may be exposed to anyone who can guess their URL. If our functions are accessible on the Internet or the local network then they could be invoked by a bad actor. By default functions respond to any request. However, if we want to control access to functions we can use Hash-based Message Authentication Code (HMAC) to validate the source of information.
@@ -26,7 +32,7 @@ We will use the `--sign` flag provided by faas-cli to send a header containing t
26
32
27
33
Let's first inspect what the flag does by deploying the `env` function which will print all of the environmental variables accessible inside the function:
Copy file name to clipboardExpand all lines: lab6.md
+21-19Lines changed: 21 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -125,6 +125,26 @@ Open your browser and access http://127.0.0.1:8080/function/show-html. You shoul
125
125
126
126
Now we're going to add a path to the function URL.
127
127
128
+
Inside `html` folder add new `list.html` file with this content:
129
+
130
+
```html
131
+
<!DOCTYPE html>
132
+
<htmllang='en'>
133
+
<head>
134
+
<metacharset='UTF-8'>
135
+
<title>OpenFaaS</title>
136
+
</head>
137
+
<body>
138
+
<h2>This is a list!</h2>
139
+
<ul>
140
+
<li>One</li>
141
+
<li>Two</li>
142
+
<li>Three</li>
143
+
</ul>
144
+
</body>
145
+
</html>
146
+
```
147
+
128
148
Edit your `handler.py` to the following:
129
149
130
150
```python
@@ -174,7 +194,7 @@ Now that we've understood how to serve html via functions, let's dynamically cha
174
194
175
195
The query string is `action=new`, hence the value of `Http_Query` would be `action=new`. We can also use the `parse_qs` function from the `urllib.parse` package and easily parse this query string.
176
196
177
-
First of all, let's create a new HTML file inside called `list.html`. So the structure should look like the following now:
197
+
The structure of the directory of our function looks like this:
178
198
179
199
```
180
200
├── show-html
@@ -187,25 +207,7 @@ First of all, let's create a new HTML file inside called `list.html`. So the str
0 commit comments