.net cas重定向问题?

发布于 2022-09-04 11:52:09 字数 5323 浏览 17 评论 0

cas认证中心运行在tomcat, 当我的.net应用跟cas处于同一服务器主机上的时候是没有问题的, 当.net应用在另一台服务器主机上的时候,就会出现循环重定向问题。

web.Config 配置如下:
<?xml version="1.0"?>

<!--
有关如何配置 ASP.NET 应用程序的详细信息,请访问
http://go.microsoft.com/fwlin...
-->

<configuration>
  <configSections>

<section name="casClientConfig" type="DotNetCasClient.Configuration.CasClientConfiguration, DotNetCasClient"/>

     <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
      <section name="Web.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </sectionGroup>
  </configSections>



  <casClientConfig
        casServerLoginUrl="https://test.gstoneg.com:8082/cas/login"
        casServerUrlPrefix="https://test.gstoneg.com:8082/cas/"
        serverName="http://cc.gstoneg.com:8088/"
        notAuthorizedUrl=""
        cookiesRequiredUrl="~/CookiesRequired.aspx"
        redirectAfterValidation="true"
        gateway="false"
        renew="false"
        singleSignOut="true"
        ticketTimeTolerance="5000"
        ticketValidatorName="Cas20"
        serviceTicketManager="CacheServiceTicketManager"
        gatewayStatusCookieName="CasGatewayStatus" />
    

  <system.web>
    <customErrors mode="Off"/>
    <compilation debug="true" targetFramework="4.0" />
    <httpRuntime requestValidationMode="2.0" />
    <pages validateRequest="false" />

    <authentication mode="Forms">

          <forms loginUrl="https://test.gstoneg.com:8082/cas/login" 
                 timeout="30" 
                 defaultUrl="~/index.aspx" 
                 cookieless="UseCookies"
                 slidingExpiration="true" 
                 path="../" />
  
     </authentication> 
      
    <authorization>
      <deny users="?"/>
      <allow users="*"/>
    </authorization>

    <membership>
      <providers>
        <clear/>
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices"
             enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
             maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
             applicationName="/" />
      </providers>
    </membership>

    <profile>
      <providers>
        <clear/>
        <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
      </providers>
    </profile>

    <httpModules>
      <add name="DotNetCasClient" type="DotNetCasClient.CasAuthenticationModule,DotNetCasClient"/>
    </httpModules>

    <sessionState mode="StateServer" cookieless="UseCookies" timeout="36000"></sessionState>
      
    <roleManager enabled="false">
      <providers>
        <clear/>
        <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
        <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
      </providers>
    </roleManager>

  </system.web>

  <system.webServer>
     <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="UserCenterBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
          receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
          bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
          useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>

  </system.serviceModel>
  <applicationSettings>
    <Web.Properties.Settings>
      <setting name="Web_imapi_UserCenter" serializeAs="String">
        <value>http://aa.rr.xx.yy:5780/usercenter/openapi.php</value>
      </setting>
    </Web.Properties.Settings>
  </applicationSettings>
</configuration>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文