Skip to content

Commit

Permalink
Initial working version
Browse files Browse the repository at this point in the history
  • Loading branch information
cicorias committed Oct 26, 2017
1 parent b5702ae commit 513d4bc
Show file tree
Hide file tree
Showing 31 changed files with 10,036 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
10 changes: 10 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": ["standard", "plugin:react/recommended" ],
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true
}

}
60 changes: 60 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

dist
76 changes: 76 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@

# Created by https://www.gitignore.io/api/node

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Build Directory
dist/
build/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Npm
package-lock.json

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# local settings
config_secret.js
config_clean.js

# System files
.DS_Store
25 changes: 25 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome",
"url": "http://localhost:8080",
"sourceMaps": true,
"sourceMapPathOverrides": {
"webpack:///*": "${workspaceFolder}/*"
}
},
{
"type": "node",
"request": "launch",
"protocol": "inspector",
"name": "Launch Program",
"program": "${workspaceFolder}/index.js"
}
]
}
81 changes: 79 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,79 @@
# react-azuread-passport
Example of React using Passport and Azure Active Directory and Authorization Code Flow
# React Azure Active Directory and Passport

> react-azuread-passport
This is an example of using React, Passport, and Azure Active Directory

## Features
- Uses React for the SPA
- Provide your Azure AD Application information in a `.env` file before running.

## Configuring

### Environment file

provide an environmenbt file based upon your Application setup in Azure Active Directory.

```
AAD_AUTH_URL=https://login.microsoftonline.com/
AAD_AUTH_CLIENTID=Application ID
AAD_AUTH_CLIENTSECRET=Secret Generated from Azure Porta
AAD_AUTH_TENANT=DNS name of your tenant
MS_GRAPH_URL=https://graph.microsoft.com/
APP_SESSION_SECRET=some word just use to validate session id in passport
```

By default if no `.env` file is used, the `config.js` files are used.


## Running

> NOTE: the commands below rely on `npx` which is part of `npm 5+`.
```
git clone https://github.com/cicorias/react-azuread-passport myapp
cd myapp
npm install
npm run bundle
npm start
```

### Development mode

In the development mode any changes to the project are automatically re-compiled and server is restarted.
To start project in development mode open two terminal windows in the root of the project.

In the first window run:

```bash
$ npm run bundle
```

That will start the webpack in the watch mode and generate the front end files.

In the second window run:
```bash
$ npm start
```

That will start up the nodeJS back end.


### Production mode

In the production mode front end files are re-compiled and minified for production use.
To start project in production mode open two terminal windows in the root of the project.

In the first window run:

```bash
$ npm run deploy
```

In the second window run:
```bash
$ npm start
```

That will start up the nodeJS back end.
28 changes: 28 additions & 0 deletions client/src/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React, { Component } from 'react'
import { HashRouter, Route, Switch } from 'react-router-dom'

import Home from './pages/Home'
import Profile from './pages/Profile'
import Page1 from './pages/Page1'
import Page2 from './pages/Page2'
import NotFound from './pages/NotFound'
import Login from './pages/Login'

import './css/app.scss'

export default class App extends Component {
render () {
return (
<HashRouter>
<Switch>
<Route exact path="/" component={Home} />
<Route path="/profile" component={Profile} />
<Route path="/page1" component={Page1} />
<Route path="/page2" component={Page2} />
<Route path="/login" component={Login} />
<Route component={NotFound} />
</Switch>
</HashRouter>
)
}
}
Loading

0 comments on commit 513d4bc

Please sign in to comment.