Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zewa666/durandalspaoauth
Durandal StarterKit with OAuth (no refresh, no membership providers)
https://github.com/zewa666/durandalspaoauth
Last synced: about 12 hours ago
JSON representation
Durandal StarterKit with OAuth (no refresh, no membership providers)
- Host: GitHub
- URL: https://github.com/zewa666/durandalspaoauth
- Owner: zewa666
- Created: 2014-02-28T11:01:00.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-08-09T08:15:58.000Z (over 10 years ago)
- Last Synced: 2023-04-06T14:20:36.284Z (over 1 year ago)
- Language: JavaScript
- Size: 11.8 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Durandal SPA OAuth StarterKit
This is a sample mockup of the [Durandal Starter Kit](https://github.com/BlueSpire/Durandal/tree/master/platforms/Microsoft.NET/Nuget/Durandal.StarterKit/content)
used together with a simple OAuth Implementation.The focus of this example is to leverage the [DotNetOpenAuth Library](http://dotnetopenauth.net/) without any .NET MembershipProviders.
Additionally the sample shows how to login via OAuth without having to leave the SPA or reload it (done via Javascript popup).This demo was inspired by following articles:
* [Using OAuthWebSecurity without SimpleMembership](http://brockallen.com/2012/09/04/using-oauthwebsecurity-without-simplemembership/)
* [Signing in without refreshing or leaving the page](http://openid-demo.appspot.com/)This setup currently just auths against Google OAuth services but can be modified easily to use other providers.
## The changes
I've introduced a new observable as a property to the durandal app object. (See main.js)
Additionally the DurandalController.cs got two new methods being LoginWithProvider (Performs the Login) and AuthentificationCallback.
The latter one is responsible to do the internal processing of the login, storing information etc. This Demo does not leverage a .NET Membership provider
since I dislike the idea of using magic stuff :-)Finally for the javascript addons take a look in the shell.js where a window popup is created and the global function OAuthHandler is called.
This way we do not need to refresh the SPA itself but just let the window popup do the redirecting work.