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
{{ message }}
This repository was archived by the owner on Feb 26, 2020. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+4-34Lines changed: 4 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,53 +1,22 @@
1
1
#Windows Azure Active Directory Sample REST API Service for Node.js using MongoDB and Restify
2
2
3
-
This Node.js server will give you with a quick and easy way to set up a REST API Service that's integrated with Windows Azure Active Directory for API protection using the OAuth2 protocol using bearer tokens. The sample server included in the download are designed to run on any platform.
3
+
This Node.js server will give you with a quick and easy way to set up a REST API Service that's integrated with Azure Active Directory for API protection using the OAuth2 protocol with bearer tokens. The sample server included in the download are designed to run on any platform.
4
4
5
5
This REST API server is built using Restify and MongoDB with the following features:
6
6
7
7
* A node.js server running an REST API interface with JSON using MongoDB as persistent storage
8
8
* REST APIs leveraging OAuth2 API protection for endpoints using Windows Azure Active Directory
9
9
10
-
[Refer to our Wiki](https://github.com/AzureADSamples/WebAPI-Nodejs/wiki) for detailed walkthroughs on how to use this server.
11
-
12
10
We've released all of the source code for this example in GitHub under an Apache 2.0 license, so feel free to clone (or even better, fork!) and provide feedback on the forums.
13
11
14
-
## How to Use The Service
15
-
16
-
This is a simple TODO Server that takes JSON requests through REST and responds with the appropriate JSON objects.
17
-
18
-
#### To use this without Authentication (for testing the endpoints without Authentication)
19
-
20
-
$ node server.js
21
-
22
-
$ curl -isS http://127.0.0.1:8888 | json
23
-
HTTP/1.1 200 OK
24
-
Connection: close
25
-
Content-Type: application/x-www-form-urlencoded
26
-
Content-Length: 145
27
-
Date: Wed, 29 Jan 2014 03:41:24 GMT
28
-
29
-
[
30
-
"GET /",
31
-
"POST /tasks/:name/:task",
32
-
"POST /tasks (for JSON body)",
33
-
"GET /tasks",
34
-
"DELETE /tasks",
35
-
"PUT /tasks/:name",
36
-
"GET /tasks/:name",
37
-
"DELETE /tasks/:task"
38
-
]
39
-
40
-
#### To invoke with OAuth2 Authentication (for use with Windows Azure AD)
41
-
42
-
$ node server.js -m oauth2
43
12
44
13
## Quick Start
45
14
46
15
Getting started with the sample is easy. It is configured to run out of the box with minimal setup.
47
16
48
17
### Step 1: Register a Windows Azure AD Tenant
49
18
50
-
To use this sample you will need a Windows Azure Active Directory Tenant. If you're not sure what a tenant is or how you would get one, read [What is a Windows Azure AD tenant](http://technet.microsoft.com/library/jj573650.aspx)? or [Sign up for Windows Azure as an organization](http://azure.microsoft.com/en-us/documentation/articles/sign-up-organization/). These docs should get you started on your way to using Windows Azure AD.
19
+
To use this sample you will need a Windows Azure Active Directory Tenant. If you're not sure what a tenant is or how you would get one, read [What is an Azure AD tenant](http://technet.microsoft.com/library/jj573650.aspx)? or [Sign up for Azure as an organization](http://azure.microsoft.com/en-us/documentation/articles/sign-up-organization/). These docs should get you started on your way to using Windows Azure AD.
51
20
52
21
### Step 2: Register your Web API with your Windows Azure AD Tenant
53
22
@@ -73,7 +42,7 @@ Next, clone the sample repo and install the NPM.
@@ -92,6 +61,7 @@ We would like to acknowledge the folks who own/contribute to the following proje
92
61
-[Restify](http://mcavage.me/node-restify/) - Restify is a node.js module built specifically to enable you to build correct REST web services. ``` node-restify```
93
62
-[Restify-OAuth2](https://github.com/domenic/restify-oauth2) - This package provides a very simple OAuth 2.0 endpoint for the Restify framework. ``` restify-oauth2```
94
63
-[node-jwt-simple](https://github.com/hokaccha/node-jwt-simple) - Library for parsing JSON Web Tokens (JWT) ```node-jwt-simple```
64
+
-[http-bearer-strategy](https://github.com/jaredhanson/passport-http-bearer) - HTTP Bearer authentication strategy for Passport and Node.js.
Copy file name to clipboardExpand all lines: node-server/config.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
// Don't commit this file to your public repos
1
+
// Don't commit this file to your public repos. This config is for first-run
2
2
exports.creds={
3
3
mongoose_auth_local: 'mongodb://localhost/tasklist',// Your mongo auth uri goes here
4
4
openid_configuration: 'https://login.microsoftonline.com/hypercubeb2c.onmicrosoft.com/.well-known/openid-configuration?p=b2c_1_B2CSI',// For using Microsoft you should never need to change this.
Copy file name to clipboardExpand all lines: node-server/server.js
+43-43Lines changed: 43 additions & 43 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
/*
2
-
Copyright (c) Microsoft Open Technologies, Inc.
2
+
Copyright (c) Microsoft Corporation
3
3
All Rights Reserved
4
4
Apache License 2.0
5
5
@@ -32,6 +32,9 @@
32
32
vargetopt=require('posix-getopt');
33
33
varconfig=require('./config');
34
34
35
+
36
+
// We pass these options in to the ODICBearerStrategy.
37
+
35
38
varoptions={
36
39
// The URL of the metadata document for your app. We will put the keys for token validation from the URL found in the jwks_uri tag of the in the metadata.
0 commit comments