asp.net web form client with identity server 4

孤人 提交于 2019-12-03 02:24:40

In WebForms you can set up authorization in web.config

<configuration>
  <system.web>
    <authorization>
      <allow roles="domainname\Managers" />
      <deny users="*" />
    </authorization>
  </system.web>
</configuration>

From the answer on StackOverflow

Also look at the web.config in example of IdentityServer3

  <location path="About">
    <system.web>
      <authorization>
        <deny users="?" />
      </authorization>
    </system.web>
  </location>

Late answer, but hopefully it helps someone, still supporting web forms.
There is no problem to use startup together with web forms. The only limitation is no place for AuthorizeAttribute there, but it's still not a problem, just put:

app.UseStageMarker(PipelineStage.Authenticate);

at the bottom of your

public void Configuration(IAppBuilder app)

method within OWIN Startup.

An example Startup implementation could be fetched from my github. It works with MVC, Web Forms and additionally brings JWT validation from IdentityServer v.3' codebase, upgraded to compile with the latest OWIN libraries.


If I still left anything unclear, don't hesitate to ask in the comments.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!