This repository has been archived by the owner on Nov 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
78 lines (69 loc) · 4.07 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#Copyright 2019 Adobe. All rights reserved.
#This file is licensed to you under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License. You may obtain a copy
#of the License at http://www.apache.org/licenses/LICENSE-2.0
#Unless required by applicable law or agreed to in writing, software distributed under
#the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
#OF ANY KIND, either express or implied. See the License for the specific language
#governing permissions and limitations under the License.
OAUTH_PACKAGE_NAME ?= oauth
CACHE_PACKAGE_NAME ?= cache
NAMESPACE ?= $(shell wsk namespace list | grep -v namespaces)
SHARED_NAMESPACE ?= $(NAMESPACE)
SHARED_OAUTH_PACKAGE ?= /$(SHARED_NAMESPACE)/$(OAUTH_PACKAGE_NAME)
SHARED_CACHE_PACKAGE ?= /$(SHARED_NAMESPACE)/$(CACHE_PACKAGE_NAME)
ADOBE_OAUTH_PACKAGE ?= myauthp
AUTH_SEQ_PACKAGE ?= myauths
AUTH_SEQ_NAME ?= $(AUTH_SEQ_PACKAGE)/authenticate
JWTAUTH_SEQ_NAME ?= $(AUTH_SEQ_PACKAGE)/jwtauthenticate
# For AWS DynamoDB (used to store the tokens)
#AWS_ACCESS_KEY_ID:= "XXX"
#AWS_SECRET_ACCESS_KEY:= "XXX"
# Required only if using AWS temporary creds.
#AWS_SESSION_TOKEN:= "XXX"
.PHONY: create-oauth-package
create-oauth-package:
npm --prefix ./node_modules/@adobe/aio-app-actions-auth-passport/ install
npm --prefix ./node_modules/@adobe/aio-app-actions-auth-passport/ run-script prepublish
wsk package get $(OAUTH_PACKAGE_NAME) --summary || wsk package create $(OAUTH_PACKAGE_NAME) --shared yes
wsk action update $(OAUTH_PACKAGE_NAME)/login ./node_modules/@adobe/aio-app-actions-auth-passport/aio-app-auth-passport.js
wsk action update $(OAUTH_PACKAGE_NAME)/success ./node_modules/@adobe/aio-app-actions-auth-passport/src/action/redirect.js --main redirect
.PHONY: create-cache-package
create-cache-package:
npm --prefix ./node_modules/@adobe/aio-app-auth-cache/ install
npm --prefix ./node_modules/@adobe/aio-app-auth-cache/ run-script prepublish
wsk package get $(CACHE_PACKAGE_NAME) --summary || wsk package create $(CACHE_PACKAGE_NAME) --shared yes
ifdef AWS_SESSION_TOKEN
wsk action update $(CACHE_PACKAGE_NAME)/persist ./node_modules/@adobe/aio-app-auth-cache/dist/main.js --main module.exports.default --param accessKeyId $(AWS_ACCESS_KEY_ID) --param secretAccessKey $(AWS_SECRET_ACCESS_KEY) --param sessionToken $(AWS_SESSION_TOKEN)
else
ifdef AWS_SECRET_ACCESS_KEY
wsk action update $(CACHE_PACKAGE_NAME)/persist ./node_modules/@adobe/aio-app-auth-cache/dist/main.js --main module.exports.default --param accessKeyId $(AWS_ACCESS_KEY_ID) --param secretAccessKey $(AWS_SECRET_ACCESS_KEY)
else
wsk action update $(CACHE_PACKAGE_NAME)/persist ./node_modules/@adobe/aio-app-auth-cache/dist/main.js --main module.exports.default
endif
endif
#TODO This should be removed or renamed at the very least
wsk action update $(CACHE_PACKAGE_NAME)/encrypt ./action/encrypt.js
.PHONY: create-jwt-package
create-jwt-package:
npm --prefix ./node_modules/@adobe/aio-app-actions-jwt-ims/ install
npm --prefix ./node_modules/@adobe/aio-app-actions-jwt-ims/ run-script prepublish
wsk package get $(OAUTH_PACKAGE_NAME) --summary || wsk package create $(OAUTH_PACKAGE_NAME) --shared yes
wsk action update $(OAUTH_PACKAGE_NAME)/jwtauth ./node_modules/@adobe/aio-app-actions-jwt-ims/dist/main.js --main module.exports.default
.PHONY: create-helper-actions
create-helper-actions:
npm --prefix ./action/ install
npm --prefix ./action/ run prepublish
wsk action update $(OAUTH_PACKAGE_NAME)/tokens ./action/dist/tokens.js --web true --main module.exports.default
wsk action update $(OAUTH_PACKAGE_NAME)/logout ./action/dist/logout.js --web true --main module.exports.default
npm-install:
npm install
.PHONY: install
install: npm-install create-oauth-package create-cache-package create-jwt-package create-helper-actions
uninstall:
wsk action delete $(CACHE_PACKAGE_NAME)/persist
wsk action delete $(CACHE_PACKAGE_NAME)/encrypt
wsk package delete $(CACHE_PACKAGE_NAME)
wsk action delete $(OAUTH_PACKAGE_NAME)/login
wsk action delete $(OAUTH_PACKAGE_NAME)/success
wsk package delete $(OAUTH_PACKAGE_NAME)