dnn web api for mobile

24
@DNNCon @ashishprasad Don’t forget to include #DNNCon in your tweets! Have Your DNN and Eat it Too (On Any Other App) Ash Prasad

Upload: ashishpd

Post on 24-May-2015

1.644 views

Category:

Technology


1 download

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

Page 1: DNN Web API For Mobile

@DNNCon @ashishprasad

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

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

Ash Prasad

Page 2: DNN Web API For Mobile

@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

Page 3: DNN Web API For Mobile

@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

Page 4: DNN Web API For Mobile

@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

Page 5: DNN Web API For Mobile

@DNNCon @ashishprasad

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

Browser & Web API – Made for each other

Page 6: DNN Web API For Mobile

@DNNCon @ashishprasad

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

Mobile Apps and WebAPI – Love Brewing

Page 7: DNN Web API For Mobile

@DNNCon @ashishprasad

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

Just 4 things

So, What’s Missing ?

Page 8: DNN Web API For Mobile

@DNNCon @ashishprasad

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

..a way to login

1. Login

Page 9: DNN Web API For Mobile

@DNNCon @ashishprasad

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

...between app and Web API

2. Shuttle Cookies

Page 10: DNN Web API For Mobile

@DNNCon @ashishprasad

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

.DOTNETNUKE is the Auth Cookie

Example

Page 11: DNN Web API For Mobile

@DNNCon @ashishprasad

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

..send to Web API

3. Antiforgery Token

Page 12: DNN Web API For Mobile

@DNNCon @ashishprasad

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

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

Example

Page 13: DNN Web API For Mobile

@DNNCon @ashishprasad

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

..send Module & Tab Ids to Web API

4. Page and Module Security

Page 14: DNN Web API For Mobile

@DNNCon @ashishprasad

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

Example

Page 15: DNN Web API For Mobile

@DNNCon @ashishprasad

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

Next Steps

• Mobile Framework

• Another simple Web API

Page 16: DNN Web API For Mobile

@DNNCon @ashishprasad

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

Mobile Frameworks – Xamarin (C#)

Page 17: DNN Web API For Mobile

@DNNCon @ashishprasad

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

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

Page 18: DNN Web API For Mobile

@DNNCon @ashishprasad

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

Mobile Frameworks – PhoneGap (JS, Html5, CSS3)

Page 19: DNN Web API For Mobile

@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

Page 20: DNN Web API For Mobile

@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

Page 21: DNN Web API For Mobile

@DNNCon @ashishprasad

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

Sample App (using Xamarin for Android

Page 22: DNN Web API For Mobile

@DNNCon @ashishprasad

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

Demo

Page 23: DNN Web API For Mobile

@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

Page 24: DNN Web API For Mobile

@DNNCon @ashishprasad

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

THANKS TO ALL OF OUR GENEROUS SPONSORS!