DNN Web API For Mobile

Post on 24-May-2015

1,643 views 1 download

Tags:

description

There has been a lot of information available about accessing DNN WebAPI from within a module, however, there isn't a lot of info on how to access those APIs securely from another client, say Windows Client or Mobile. I've developed sample apps in Win Forms to access Core or Custom Web APIs keeping in mind Anti-Forgery and Module / Tab Permissions. Join me to get tips and tricks on writing WebAPIs in DNN that can be securely accessed (using Anti-Forgery and obeying Module Permission) from DNN Modules as well as outside.

transcript

@DNNCon @ashishprasad

Don’t forget to include #DNNCon in your tweets!

Have Your DNN and Eat it Too (On Any Other App)

Ash Prasad

@DNNCon @ashishprasad

Don’t forget to include #DNNCon in your tweets!

• History of DNN Web API• What’s included in DNN Web API• Stuff that’s missing• How to bridge the gap• Let’s build a Mobile App!

Agenda

@DNNCon @ashishprasad

Don’t forget to include #DNNCon in your tweets!

• First introduced in 6.2 (May2012)• Called Services Framework• Based on ASP.Net MVC

• New version released with 7.0 (Nov 2012)• Called DNN Web API• Based on ASP.Net Web API

History of DNN Web API

@DNNCon @ashishprasad

Don’t forget to include #DNNCon in your tweets!

• RESTFul• Seamless Authentication &

Autherization• Integrates with Module/Tab

Permission• Anti Forgery

• Access to standard DNN Entities • Portal Settings, Current User, Active

Tab

• Helper JS library• Works really well in Web Forms

What’s included in DNN Web API

@DNNCon @ashishprasad

Don’t forget to include #DNNCon in your tweets!

Browser & Web API – Made for each other

@DNNCon @ashishprasad

Don’t forget to include #DNNCon in your tweets!

Mobile Apps and WebAPI – Love Brewing

@DNNCon @ashishprasad

Don’t forget to include #DNNCon in your tweets!

Just 4 things

So, What’s Missing ?

@DNNCon @ashishprasad

Don’t forget to include #DNNCon in your tweets!

..a way to login

1. Login

@DNNCon @ashishprasad

Don’t forget to include #DNNCon in your tweets!

...between app and Web API

2. Shuttle Cookies

@DNNCon @ashishprasad

Don’t forget to include #DNNCon in your tweets!

.DOTNETNUKE is the Auth Cookie

Example

@DNNCon @ashishprasad

Don’t forget to include #DNNCon in your tweets!

..send to Web API

3. Antiforgery Token

@DNNCon @ashishprasad

Don’t forget to include #DNNCon in your tweets!

..in pair, send both - from Page and Cookie

Example

@DNNCon @ashishprasad

Don’t forget to include #DNNCon in your tweets!

..send Module & Tab Ids to Web API

4. Page and Module Security

@DNNCon @ashishprasad

Don’t forget to include #DNNCon in your tweets!

Example

@DNNCon @ashishprasad

Don’t forget to include #DNNCon in your tweets!

Next Steps

• Mobile Framework

• Another simple Web API

@DNNCon @ashishprasad

Don’t forget to include #DNNCon in your tweets!

Mobile Frameworks – Xamarin (C#)

@DNNCon @ashishprasad

Don’t forget to include #DNNCon in your tweets!

Mobile Frameworks – Icenium (JS, Html5, CSS3, KendoUI)

@DNNCon @ashishprasad

Don’t forget to include #DNNCon in your tweets!

Mobile Frameworks – PhoneGap (JS, Html5, CSS3)

@DNNCon @ashishprasad

Don’t forget to include #DNNCon in your tweets!

• New DLL (Library)• One Web API Method • GetTabAndModuleId(string

moduleName)

New Simple Web API

@DNNCon @ashishprasad

Don’t forget to include #DNNCon in your tweets!

Architecture

Mobile Server

One new Web API

Core Web APIs

Your Web APIs

New Library - Login, AntiForgery, Cookie,

Module/TabId

Core FE

Your FE

@DNNCon @ashishprasad

Don’t forget to include #DNNCon in your tweets!

Sample App (using Xamarin for Android

@DNNCon @ashishprasad

Don’t forget to include #DNNCon in your tweets!

Demo

@DNNCon @ashishprasad

Don’t forget to include #DNNCon in your tweets!

• Web APIs are great• We can make ‘em work on

Mobile• Need a library• You can build Mobile Apps

today!

Recap

@DNNCon @ashishprasad

Don’t forget to include #DNNCon in your tweets!

THANKS TO ALL OF OUR GENEROUS SPONSORS!