-Paket -TutorialFiles

Removed Paket files (could not get reliable builds; we may revisit once
.NET core has stablizied); removed extraneous tutorial files; currently
blocked getting Auth0 Lock to load from within Aurelia app
This commit is contained in:
Daniel J. Summers committed 2017-05-31 22:22:08 -05:00
1 parent b0b20df36d
commit 55cf47af18
22 files changed
+125 -1583

No files matched your search

+6
View File
@@ -100,6 +100,7 @@
"aurelia-dependency-injection",
"aurelia-event-aggregator",
"aurelia-framework",
"aurelia-fetch-client",
"aurelia-history",
"aurelia-history-browser",
"aurelia-loader",
@@ -151,6 +152,11 @@
"resources": [
"nprogress.css"
]
},
{
"name": "auth0-lock",
"path": "../node_modules/auth0-lock",
"main": "lib/index"
}
]
}
+2
View File
@@ -10,6 +10,8 @@
"dependencies": {
"aurelia-animator-css": "^1.0.1",
"aurelia-bootstrapper": "^2.1.0",
"aurelia-fetch-client": "^1.1.2",
"auth0-lock": "^10.16.0",
"bluebird": "^3.4.1",
"bootstrap": "^3.3.7",
"jquery": "^2.2.4",
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///auth0.min.js","\\node_modules\\auth0-js\\build/webpack:/webpack/bootstrap 7b1004490308b0712546","webpack:///~/url-join/lib/url-join.js","webpack:///src/helper/object.js","webpack:///src/helper/window.js","webpack:///src/helper/assert.js","webpack:///~/qs/lib/index.js","webpack:///src/helper/response-handler.js","webpack:///~/qs/lib/formats.js","webpack:///~/qs/lib/utils.js","webpack:///src/version.js","webpack:///src/helper/request-builder.js","webpack:///src/helper/warn.js","webpack:///~/qs/lib/parse.js","webpack:///~/qs/lib/stringify.js","webpack:///~/superagent/lib/is-object.js","webpack:///~/base64-js/index.js","webpack:///~/idtoken-verifier/src/helpers/base64.js","webpack:///~/superagent/lib/client.js","webpack:///~/winchan/winchan.js","webpack:///src/authentication/index.js","webpack:///src/helper/base64_url.js","webpack:///src/helper/error.js","webpack:///src/web-auth/transaction-manager.js","webpack:///~/component-emitter/index.js","webpack:///~/crypto-js/core.js","webpack:///~/crypto-js/sha256.js","webpack:///~/idtoken-verifier/src/helpers/dummy-cache.js","webpack:///~/idtoken-verifier/src/helpers/error.js","webpack:///~/idtoken-verifier/src/helpers/jwks.js","webpack:///~/idtoken-verifier/src/helpers/rsa-verifier.js","webpack:///~/idtoken-verifier/src/index.js","webpack:///~/jsbn/index.js","webpack:///~/superagent/lib/is-function.js","webpack:///~/superagent/lib/request-base.js","webpack:///~/superagent/lib/response-base.js","webpack:///~/superagent/lib/should-retry.js","webpack:///~/superagent/lib/utils.js","webpack:///src/authentication/db-connection.js","webpack:///src/authentication/passwordless-authentication.js","webpack:///src/helper/cookies.js","webpack:///src/helper/iframe-handler.js","webpack:///src/helper/object-assign.js","webpack:///src/helper/parameters-whitelist.js","webpack:///src/helper/plugins.js","webpack:///src/helper/popup-handler.js","webpack:///src/helper/random.js","webpack:///src/helper/storage.js","webpack:///src/helper/storage/cookie.js","webpack:///src/helper/storage/dummy.js","webpack:///src/helper/storage/handler.js","webpack:///src/helper/url.js","webpack:///src/index.js","webpack:///src/management/index.js","webpack:///src/web-auth/cross-origin-authentication.js","webpack:///src/web-auth/index.js","webpack:///src/web-auth/popup.js","webpack:///src/web-auth/redirect.js","webpack:///src/web-auth/silent-authentication-handler.js","webpack:///src/web-auth/username-password.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","__WEBPACK_AMD_DEFINE_FACTORY__","__WEBPACK_AMD_DEFINE_RESULT__","name","context","definition","undefined","normalize","str","options","replace","input","arguments","joined","slice","join","pick","object","keys","reduce","prev","key","getKeysNotIn","obj","allowedKeys","notAllowed","indexOf","push","objectValues","values","extend","params","unshift","objectAssign","get","apply","merge","base","with","object2","keys2","blacklist","blacklistedKeys","Object","camelToSnake","code","newKey","index","wasPrevNumber","wasPrevUppercase","length","charCodeAt","toLowerCase","snakeToCamel","parts","split","charAt","toUpperCase","shift","toSnakeCase","exceptions","assert","isArray","toCamelCase","global","redirect","url","window","location","getDocument","document","getWindow","attribute","o","attr","type","text","Error","variable","value","check","config","attributes","optional","message","a","condition","value_message","array","supportsIsArray","Array","toString","prototype","stringify","parse","formats","wrapCallback","cb","ignoreCasing","err","data","errObj","error","original","response","statusCode","statusText","body","error_code","status","description","errorDescription","error_description","details","policy","objectHelper","buildResponse","String","percentTwenties","default","formatters","RFC1738","RFC3986","has","hasOwnProperty","hexTable","i","arrayToObject","source","plainObjects","create","target","allowPrototypes","concat","mergeTarget","forEach","item","acc","decode","decodeURIComponent","e","encode","string","out","compact","references","refs","lookup","compacted","isRegExp","isBuffer","constructor","raw","RequestWrapper","req","request","method","_data","headers","_header","RequestObj","RequestBuilder","_sendTelemetry","_telemetryInfo","base64Url","version","abort","getMethod","getBody","getUrl","getHeaders","set","send","withCredentials","end","setCommonConfiguration","ongoingRequest","noHeaders","getTelemetryData","clientInfo","jsonClientInfo","JSON","post","patch","Warn","disableWarnings","warning","console","warn","utils","defaults","allowDots","arrayLimit","decoder","delimiter","depth","parameterLimit","strictNullHandling","parseValues","Infinity","val","part","pos","parseObject","chain","cleanRoot","parseInt","isNaN","parseArrays","parseKeys","giveLine truncated
+2
View File
@@ -15,6 +15,8 @@
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li if.bind="!isAuthenticated()" click.delegate="logon()">Log On</li>
<li if.bind="isAuthenticated()" click.delegate="logoff()">Log Off</li>
</ul>
</div>
</div>
+58 -5
View File
@@ -1,16 +1,66 @@
import {Router, RouterConfiguration} from "aurelia-router"
import {EventAggregator} from "aurelia-event-aggregator"
import {inject} from "aurelia-framework"
import {HttpClient} from "aurelia-fetch-client"
import {PageTitle} from "./messages"
import {WebAPI} from "./web-api"
import {Auth0Lock} from "auth0-lock"
@inject(WebAPI, EventAggregator)
@inject(EventAggregator, HttpClient)
export class App {
router: Router;
pageTitle: string;
lock = new Auth0Lock('Of2s0RQCQ3mt3dwIkOBY5h85J9sXbF2n', 'djs-consulting.auth0.com', {
oidcConformant: true,
autoclose: true,
auth: {
redirectUrl: "http://localhost:8080/user/log-on",
responseType: 'token id_token',
audience: `https://djs-consulting.auth0.com/userinfo`,
params: {
scope: 'openid'
}
}
})
constructor(public api: WebAPI, private ea: EventAggregator) {
private setSession(authResult): void {
// Set the time that the access token will expire at
const expiresAt = JSON.stringify((authResult.expiresIn * 1000) + new Date().getTime())
localStorage.setItem('access_token', authResult.accessToken)
localStorage.setItem('id_token', authResult.idToken)
localStorage.setItem('expires_at', expiresAt)
}
public logoff(): void {
// Remove tokens and expiry time from localStorage
localStorage.removeItem('access_token')
localStorage.removeItem('id_token')
localStorage.removeItem('expires_at')
// Go back to the home route
this.router.navigateToRoute("")
}
public isAuthenticated(): boolean {
// Check whether the current time is past the
// access token's expiry time
const expiresAt = JSON.parse(localStorage.getItem('expires_at'))
return new Date().getTime() < expiresAt
}
constructor(private ea: EventAggregator, private http: HttpClient) {
this.ea.subscribe(PageTitle, msg => this.pageTitle = msg.title)
var self = this
this.lock.on('authenticated', (authResult) => {
if (authResult && authResult.accessToken && authResult.idToken) {
this.setSession(authResult)
this.router.navigateToRoute("")
}
});
this.lock.on('authorization_error', (err) => {
this.router.navigateToRoute("")
console.log(err)
alert(`Error: ${err.error}. Check the console for further details.`)
});
}
configureRouter(config: RouterConfiguration, router: Router){
@@ -18,10 +68,13 @@ export class App {
config.options.pushState = true
config.options.root = "/"
config.map([
{ route: "", moduleId: "home", name: "home", title: "Welcome" },
{ route: 'contacts/:id', moduleId: 'contact-detail', name:'contacts' }
{ route: "", moduleId: "home", name: "home", title: "Welcome" }
])
this.router = router
}
public logon() {
this.lock.show()
}
}
-42
View File
@@ -1,42 +0,0 @@
<template>
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Profile</h3>
</div>
<div class="panel-body">
<form role="form" class="form-horizontal">
<div class="form-group">
<label class="col-sm-2 control-label">First Name</label>
<div class="col-sm-10">
<input type="text" placeholder="first name" class="form-control" value.bind="contact.firstName">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Last Name</label>
<div class="col-sm-10">
<input type="text" placeholder="last name" class="form-control" value.bind="contact.lastName">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Email</label>
<div class="col-sm-10">
<input type="text" placeholder="email" class="form-control" value.bind="contact.email">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Phone Number</label>
<div class="col-sm-10">
<input type="text" placeholder="phone number" class="form-control" value.bind="contact.phoneNumber">
</div>
</div>
</form>
</div>
</div>
<div class="button-bar">
<button class="btn btn-success" click.delegate="save()" disabled.bind="!canSave">Save</button>
</div>
</template>
-58
View File
@@ -1,58 +0,0 @@
import {inject} from 'aurelia-framework';
import {EventAggregator} from 'aurelia-event-aggregator';
import {WebAPI} from './web-api';
import {ContactUpdated,ContactViewed} from './messages';
import {areEqual} from './utility';
interface Contact {
firstName: string;
lastName: string;
email: string;
}
@inject(WebAPI, EventAggregator)
export class ContactDetail {
routeConfig;
contact: Contact;
originalContact: Contact;
constructor(private api: WebAPI, private ea: EventAggregator) { }
activate(params, routeConfig) {
this.routeConfig = routeConfig;
return this.api.getContactDetails(params.id).then(contact => {
this.contact = <Contact>contact;
this.routeConfig.navModel.setTitle(this.contact.firstName);
this.originalContact = JSON.parse(JSON.stringify(this.contact));
this.ea.publish(new ContactViewed(this.contact));
});
}
get canSave() {
return this.contact.firstName && this.contact.lastName && !this.api.isRequesting;
}
save() {
this.api.saveContact(this.contact).then(contact => {
this.contact = <Contact>contact;
this.routeConfig.navModel.setTitle(this.contact.firstName);
this.originalContact = JSON.parse(JSON.stringify(this.contact));
this.ea.publish(new ContactUpdated(this.contact));
});
}
canDeactivate() {
if(!areEqual(this.originalContact, this.contact)){
let result = confirm('You have unsaved changes. Are you sure you wish to leave?');
if(!result) {
this.ea.publish(new ContactViewed(this.contact));
}
return result;
}
return true;
}
}
-12
View File
@@ -1,12 +0,0 @@
<template>
<div class="contact-list">
<ul class="list-group">
<li repeat.for="contact of contacts" class="list-group-item ${contact.id === $parent.selectedId ? 'active' : ''}">
<a route-href="route: contacts; params.bind: {id:contact.id}" click.delegate="$parent.select(contact)">
<h4 class="list-group-item-heading">${contact.firstName} ${contact.lastName}</h4>
<p class="list-group-item-text">${contact.email}</p>
</a>
</li>
</ul>
</div>
</template>
-28
View File
@@ -1,28 +0,0 @@
import {EventAggregator} from 'aurelia-event-aggregator';
import {WebAPI} from './web-api';
import {ContactUpdated, ContactViewed} from './messages';
import {inject} from 'aurelia-framework';
@inject(WebAPI, EventAggregator)
export class ContactList {
contacts;
selectedId = 0;
constructor(private api: WebAPI, ea: EventAggregator) {
ea.subscribe(ContactViewed, msg => this.select(msg.contact));
ea.subscribe(ContactUpdated, msg => {
let id = msg.contact.id;
let found = this.contacts.find(x => x.id == id);
Object.assign(found, msg.contact);
});
}
created() {
this.api.getContactList().then(contacts => this.contacts = contacts);
}
select(contact) {
this.selectedId = contact.id;
return true;
}
}
-8
View File
@@ -1,11 +1,3 @@
export class ContactUpdated {
constructor(public contact) { }
}
export class ContactViewed {
constructor(public contact) { }
}
export class PageTitle {
constructor(public title: string) { }
}
-96
View File
@@ -1,96 +0,0 @@
let latency = 200;
let id = 0;
function getId(){
return ++id;
}
let contacts = [
{
id:getId(),
firstName:'John',
lastName:'Tolkien',
email:'tolkien@inklings.com',
phoneNumber:'867-5309'
},
{
id:getId(),
firstName:'Clive',
lastName:'Lewis',
email:'lewis@inklings.com',
phoneNumber:'867-5309'
},
{
id:getId(),
firstName:'Owen',
lastName:'Barfield',
email:'barfield@inklings.com',
phoneNumber:'867-5309'
},
{
id:getId(),
firstName:'Charles',
lastName:'Williams',
email:'williams@inklings.com',
phoneNumber:'867-5309'
},
{
id:getId(),
firstName:'Roger',
lastName:'Green',
email:'green@inklings.com',
phoneNumber:'867-5309'
}
];
export class WebAPI {
isRequesting = false;
getContactList(){
this.isRequesting = true;
return new Promise(resolve => {
setTimeout(() => {
let results = contacts.map(x => { return {
id:x.id,
firstName:x.firstName,
lastName:x.lastName,
email:x.email
}});
resolve(results);
this.isRequesting = false;
}, latency);
});
}
getContactDetails(id){
this.isRequesting = true;
return new Promise(resolve => {
setTimeout(() => {
let found = contacts.filter(x => x.id == id)[0];
resolve(JSON.parse(JSON.stringify(found)));
this.isRequesting = false;
}, latency);
});
}
saveContact(contact){
this.isRequesting = true;
return new Promise(resolve => {
setTimeout(() => {
let instance = JSON.parse(JSON.stringify(contact));
let found = contacts.filter(x => x.id == contact.id)[0];
if(found){
let index = contacts.indexOf(found);
contacts[index] = instance;
}else{
instance.id = getId();
contacts.push(instance);
}
this.isRequesting = false;
resolve(instance);
}, latency);
});
}
}