Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
.idea/
*.iml
*.iws
*.tgz
2 changes: 1 addition & 1 deletion sample-proxies/oauth-advanced/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ To run this sample, you'll need:

* Yeoman [installed](http://yeoman.io/)

* Install oauth-auth-code-grant-sample generator:
* Install oauth-auth-code-grant-sample generator (You can find the source code [here](https://github.com/apigee/api-platform-samples/blob/master/sample-proxies/oauth-advanced/app/index.js)):
`npm install generator-oauth-auth-code-grant-sample -g`

* Please note that the sample does not run properly in Windows 10. Please run in macOS or Linux for full compatibility.
Expand Down
18 changes: 9 additions & 9 deletions sample-proxies/oauth-advanced/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,31 +98,31 @@ module.exports = yeoman.generators.Base.extend({

// deploy user-mgmt-v1
shell.cd('user-mgmt-v1');
shell.exec('apigeetool deployproxy -u '+this.uname+' -p '+this.password+' -o '+this.orgname+' -e '+this.envname+ ' -n user-mgmt-v1 -d .');
shell.exec('apigeetool deployproxy -u '+this.uname+' -p \''+this.password+'\' -o '+this.orgname+' -e '+this.envname+ ' -n user-mgmt-v1 -d .');

// deploy oauth2
shell.cd('../oauth2');
shell.exec('apigeetool deployproxy -u '+this.uname+' -p '+this.password+' -o '+this.orgname+' -e '+this.envname+ ' -n oauth2 -d .');
shell.exec('apigeetool deployproxy -u '+this.uname+' -p \''+this.password+'\' -o '+this.orgname+' -e '+this.envname+ ' -n oauth2 -d .');

// provision login-app
shell.cd('../provisioning');
shell.exec('./provision-login-app.sh '+this.uname+' '+this.password+' '+this.orgname+' '+this.envname+' '+this.mgmtapiurl);
shell.exec('./provision-login-app.sh '+this.uname+' \''+this.password+'\' '+this.orgname+' '+this.envname+' '+this.mgmtapiurl);

// npm install for login-app
shell.cd('../login-app/apiproxy/resources/node');
shell.exec('npm install');

// deploy login-app
shell.cd('../../..');
shell.exec('apigeetool deployproxy -u '+this.uname+' -p '+this.password+' -o '+this.orgname+' -e '+this.envname+ ' -n login-app -d . -U');
shell.exec('apigeetool deployproxy -u '+this.uname+' -p \''+this.password+'\' -o '+this.orgname+' -e '+this.envname+ ' -n login-app -d . -U');

// provision webserver
shell.cd('../provisioning');
shell.exec('./provision-webserver.sh '+this.uname+' '+this.password+' '+this.orgname+' '+this.envname+' '+this.mgmtapiurl);
shell.exec('./provision-webserver.sh '+this.uname+' \''+this.password+'\' '+this.orgname+' '+this.envname+' '+this.mgmtapiurl);

//capture clientID and secret from last step and put in webserver-app bundle
var webserverappkey = shell.exec("curl -H 'Accept: application/json' -u "+this.uname+":"+this.password+" "+this.mgmtapiurl+"/v1/o/"+this.orgname+"/developers/[email protected]/apps/webserver-app 2>/dev/null | grep consumerKey | awk -F '\"' '{ print $4 }'").output;
var webserverappsecret = shell.exec("curl -H 'Accept: application/json' -u "+this.uname+":"+this.password+" "+this.mgmtapiurl+"/v1/o/"+this.orgname+"/developers/[email protected]/apps/webserver-app 2>/dev/null | grep consumerSecret | awk -F '\"' '{ print $4 }'").output;
var webserverappkey = shell.exec("curl -H 'Accept: application/json' -u '"+this.uname+":"+this.password+"' "+this.mgmtapiurl+"/v1/o/"+this.orgname+"/developers/[email protected]/apps/webserver-app 2>/dev/null | grep consumerKey | awk -F '\"' '{ print $4 }'").output;
var webserverappsecret = shell.exec("curl -H 'Accept: application/json' -u '"+this.uname+":"+this.password+"' "+this.mgmtapiurl+"/v1/o/"+this.orgname+"/developers/[email protected]/apps/webserver-app 2>/dev/null | grep consumerSecret | awk -F '\"' '{ print $4 }'").output;
// remove trailing whitespace
webserverappkey = webserverappkey.replace(/\n$/, "");
webserverappsecret = webserverappsecret.replace(/\n$/, "");
Expand All @@ -142,8 +142,8 @@ module.exports = yeoman.generators.Base.extend({

shell.cd('webserver-app');
//deploy webserver-app bundle
shell.exec('apigeetool deployproxy -u '+this.uname+' -p '+this.password+' -o '+this.orgname+' -e '+this.envname+ ' -n webserver-app -d .');
shell.exec('apigeetool deployproxy -u '+this.uname+' -p \''+this.password+'\' -o '+this.orgname+' -e '+this.envname+ ' -n webserver-app -d .');

},

});
});
11 changes: 4 additions & 7 deletions sample-proxies/oauth-advanced/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "generator-oauth-auth-code-grant-sample",
"version": "0.1.6",
"version": "0.1.10",
"description": "Generator for OAuth authorization code grant type using Apigee",
"files": [
"app",
Expand All @@ -23,14 +23,11 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/dzuluaga/oauth-auth-code-grant-sample.git"
},
"repository": "github:apigee/api-platform-samples/sample-proxies/oauth-advanced",
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/dzuluaga/oauth-auth-code-grant-sample/issues"
"url": "https://github.com/apigee/api-platform-samples/issues"
},
"homepage": "https://github.com/dzuluaga/oauth-auth-code-grant-sample#readme"
"homepage": "https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/oauth-advanced#readme"
}