Mauro Cerutti
Mauro Cerutti

Reputation: 684

Different authentication method for different modules in NancyFx

I have a web application consisting of five Nancy modules. The authentication in based on Nancy.Authentication.Forms.

I would like to add another NancyModule. For that module only, I would like to use stateless authentication.

How may I do that?

Upvotes: 2

Views: 274

Answers (1)

Corstiaan
Corstiaan

Reputation: 1114

I solved this by enabling the appropriate authentication method on a per request basis in the bootstrapper. You can use the RequestStartup method for this. Then, in your modules, just call this.RequiresAuthentication method. Since the bootstrapper already loaded the appropriate authentication mechanism, the module just authenticates with whatever mechanism was enabled. Are your trying to build an api and forms front end in the same project?

Upvotes: 1

Related Questions