Cookie authentication in websharper + suave + OWIN
Asked Answered
C

0

7

As part of an evaluation process for a commercial project I'm searching for any full fledged example of authentication/authorization using the websharper stack. I'd like to use OWIN, since it seems to be a well designed protocol, but I'm open to alternatives.

Some requirements:

  • use Mono
  • use the Suave server.

For now, we have been trying to adapt this tutorial for the websharper toolchain: https://www.codeproject.com/tips/849113/four-easy-steps-to-set-up-owin-for-form-authentica

This is what we currently have: https://github.com/Denommus/cookies-problem/blob/master/Main.fs

I would also like to mention that the default method ctx.UserSession.LoginUser has this issue: https://github.com/intellifactory/websharper/issues/647

But the cookies file is not being generated for some reason, probably because we're missing something obvious. Anyone able to help?

EDIT

I think I figured out the reason why the cookies file is not being generated: the Suave server doesn't actually run OwinStartup, so I need to figure out another way to configure the IAppBuilder of my application. But I still don't know how to do it, so if anyone can help I'll appreciate.

EDIT 2

I think I fixed the configuration of OWIN in my application, but I still don't have cookies being generated.

Cleruchy answered 10/2, 2017 at 12:39 Comment(1)
I can't be sure until I do more testing myself, but I think the problem here is that you're passing the authentication middleware as a separate Suave WebPart, so it's in a separate Owin pipeline. WebSharper.Suave doesn't currently allow customizing its Owin pipeline; let me try right now to implement that and see if that would fix this.My

© 2022 - 2024 — McMap. All rights reserved.