passport icon indicating copy to clipboard operation
passport copied to clipboard

support Passport as Koa-middleware

Open 0xgeert opened this issue 10 years ago • 31 comments

Would be great to be able to use passport as part of koa.

Perhaps this could be a wrapper to expose the middleware (*) as generator functions instead.

0xgeert avatar Dec 26 '13 15:12 0xgeert

Yep, I'm looking forward to implementing koa support. No ETA at the moment, but it'll happen.

jaredhanson avatar Dec 26 '13 17:12 jaredhanson

Great to hear. Any pointers on what might need to be done? I may be able to help it move forward.

0xgeert avatar Dec 27 '13 13:12 0xgeert

The files in the middleware directory will need some adjusting. A first step would be to factor them into middleware/connect and middleware/koa, and see what common things can be abstracted.

jaredhanson avatar Dec 27 '13 16:12 jaredhanson

+1 for this, would like to hear updates

ktmud avatar Jan 08 '14 02:01 ktmud

+1

ArdentZeal avatar Jan 08 '14 16:01 ArdentZeal

+1 as well

brycejacobs avatar Jan 08 '14 17:01 brycejacobs

+1

evert0n avatar Jan 09 '14 11:01 evert0n

I build a wrapper module: koa-passport. Unfortunately, to wrap the authentication middleware it required some dirty workarounds. That is, the functionality for some options is missing. Only tested with LocalStrategy, yet.

rkusa avatar Jan 15 '14 01:01 rkusa

@rkusa - Awesome, that looks like a great start! At some point in the next couple of weeks I want to put together a clean Koa implementation, potentially abstracting anything in Passport proper that could be shared. Would you mind if I modified your code and submitted a PR?

jaredhanson avatar Jan 15 '14 01:01 jaredhanson

@jaredhanson Sure, and if it helps, I could add some comments to the source to explain the workarounds a little bit.

rkusa avatar Jan 15 '14 10:01 rkusa

@rkusa That would help, thanks!

jaredhanson avatar Jan 15 '14 15:01 jaredhanson

+1 great work!

rail44 avatar Jan 26 '14 15:01 rail44

@jaredhanson : @rkusa added some comments to https://github.com/rkusa/koa-passport/commit/a11c83f1e8efc58ed42d34d2b23338c543b921d3 last week.

I've made some unsuccessful tests with SoundcloudStrategy.

oomathias avatar Feb 07 '14 17:02 oomathias

@oomathias if you want, I could take a look at your problem. Feel free to create a issue at koa-passwort providing some more information about your problem.

rkusa avatar Feb 07 '14 20:02 rkusa

I saw jared refactored the code with a "framework" mechanism, so koa support should be done with that?

I just implemented that based on @rkusa 's work: https://github.com/ktmud/koa-passport-fw/blob/master/index.js

Should I make a PR or something?

ktmud avatar Feb 22 '14 13:02 ktmud

+1

qur2 avatar Apr 20 '14 08:04 qur2

Any update on the status? I'm confused about how to use koa together with passport: koa-passport-fw, koa-passport or just passport?

qur2 avatar Apr 23 '14 08:04 qur2

@qur2 passport does not work with Koa directly. That is, you have to use koa-passport or koa-passport-fw (both use the framework mechanism introduced in passport 0.2.0).

rkusa avatar Apr 23 '14 08:04 rkusa

Ok, thanks, I'll try both those project and see what I can achieve.

qur2 avatar Apr 26 '14 07:04 qur2

+1 for better integration without hacks & mocks.

iliakan avatar Jul 18 '14 10:07 iliakan

+1

Definitely would be good to see a framework-agnostic core emerge as the ecosystem evolves. Especially once node hits 0.12 and koa approaches mainstream viability.

greim avatar Oct 23 '14 17:10 greim

+1

sepmein avatar Dec 04 '14 07:12 sepmein

still no progress?

smeijer avatar Dec 10 '16 19:12 smeijer

₊1

vnenkpet avatar Dec 18 '16 06:12 vnenkpet

+1

Arnoldnuo avatar Jul 26 '17 11:07 Arnoldnuo

+1

guzuomuse avatar Aug 04 '17 13:08 guzuomuse

+1

beilunyang avatar Sep 25 '17 02:09 beilunyang

+1

Tomotoes avatar Apr 26 '18 13:04 Tomotoes

+1

gaochengyidlmu avatar Jul 10 '18 08:07 gaochengyidlmu

Notice that Authenticator.prototype.framework function, So i build a Koa framework plugin module passport-koa to support Koa. It work like a plugin for passport passport.framework(passport-koa). Tested with CustomStrategy and JWTStrategy by now.

LouisWT avatar Jul 23 '18 01:07 LouisWT