Skip to content

Commit c02790f

Browse files
reviewed
1 parent 9a3741b commit c02790f

File tree

8 files changed

+27
-9
lines changed

8 files changed

+27
-9
lines changed

app-dev/devops-and-containers/functions/js-authorizer-oci-fn-example/README.md

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,18 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3636
SOFTWARE.
3737
-->
3838

39-
## Functions overview
40-
[Document functions-overview](files/Fn.pdf)
39+
# API Gateway authorizer function context var example
4140

42-
### Author
41+
Reviewed: 31.10.2024
42+
43+
# When to use this asset?
44+
45+
Anyone who wants to test OCI Queue service using OCI SDK in JavaScript and do this from GitHub Actions.
46+
47+
# Author
4348
<a href="https://github.com/mikarinneoracle">mikarinneoracle</a>
4449

45-
# API Gateway authorizer function context var example
50+
# How to use this asset?
4651

4752
## Build and deploy the functions
4853

@@ -59,23 +64,23 @@ fdk.handle(function(input){
5964
"principal": "myprincipal",
6065
"scope": ["fnsimplejs"],
6166
"clientId": "clientIdFromHeader",
62-
"expiresAt": "2023-12-31T00:00:00+00:00",
67+
"expiresAt": "2025-12-31T00:00:00+00:00",
6368
"context": {
6469
"username": input.token
6570
}
6671
}
6772
} else {
6873
json = {
6974
"active": false,
70-
"expiresAt": "2023-12-31T00:00:00+00:00",
75+
"expiresAt": "2025-12-31T00:00:00+00:00",
7176
"wwwAuthenticate": "Bearer realm=\"www.com\""
7277
}
7378
}
7479
return json;
7580
})
7681
</pre>
7782

78-
The authorizer function will pass on the <code>username</code> in <code>auth context</code> as a custom variable. The value for it is set from REST call input as <code>token</code> on the <a href="fnauthjs/func.js#L52">line 52</a>.
83+
The authorizer function will pass on the <code>username</code> in <code>auth context</code> as a custom variable. The value for it is set from REST call input as <code>token</code> on the <a href="files/fnauthjs/func.js#L52">line 52</a>.
7984
<br>
8085
Here's the call using API Gateway:
8186
<pre>
@@ -94,7 +99,7 @@ fdk.handle(function(input, ctx){
9499

95100
The secondary / backend function will get the authorizer passed variable <code>username</code>
96101
as a transformed header variable <code>Fn-Http-H-Username</code> and will print it out as the
97-
function REST call result on the <a href="fnsimplejs/func.js#L42">line 42</a>.
102+
function REST call result on the <a href="files/fnsimplejs/func.js#L42">line 42</a>.
98103
<br>
99104
Here's the call using API Gateway:
100105
<pre>
@@ -144,4 +149,17 @@ curl https://drp....56kvgu.apigateway.eu-amsterdam-1.oci.customer-oci.com/
144149
{"code":401,"message":"Unauthorized"}
145150
</pre>
146151

152+
# Useful Links
153+
154+
- [OCI Functions](https://docs.oracle.com/en-us/iaas/Content/Functions/Concepts/functionsoverview.htm)
155+
- Learn how the Functions service lets you create, run, and scale business logic without managing any infrastructure
156+
- [Oracle](https://www.oracle.com/)
157+
- Oracle Website
158+
159+
### License
160+
161+
Copyright (c) 2024 Oracle and/or its affiliates.
162+
163+
Licensed under the Universal Permissive License (UPL), Version 1.0.
147164

165+
See [LICENSE](https://github.com/oracle-devrel/technology-engineering/blob/main/LICENSE) for more details.
Binary file not shown.

app-dev/devops-and-containers/functions/js-authorizer-oci-fn-example/fnsimplejs/package.json renamed to app-dev/devops-and-containers/functions/js-authorizer-oci-fn-example/files/fnsimplejs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "hellofn",
2+
"name": "fnsimplejs",
33
"version": "1.0.0",
44
"description": "example function",
55
"main": "func.js",

0 commit comments

Comments
 (0)