<authentication mode="Forms" >
<forms name="casauth" loginUrl="login.aspx" />
</authentication>
<authorization>
<deny users="?" />
</authorization>
//CAS íw«ä†¾éªŒè¯ æœåŠ¡å™¨åœ°å€
private const string CASHOST = "https://sso.gzps.net:8443/cas/";
protected void Page_Load(object sender, EventArgs e)
{
System.Net.ServicePointManager.CertificatePolicy = new MyPolicy();
// Look for the "ticket=" after the "?" in the URL
string tkt = Request.QueryString["ticket"];
// This page is the CAS service=, but discard any query string residue
string service = Request.Url.GetLeftPart(UriPartial.Path);
// First time through there is no ticket=, so redirect to CAS login
if (tkt == null || tkt.Length == 0)
{
string redir = CASHOST + "login?" +
"service=" + service;
Response.Redirect(redir);
return;
}
// Second time (back from CAS) there is a ticket= to validate
string validateurl = CASHOST + "serviceValidate?" +
"ticket=" + tkt + "&"+
"service=" + service;
StreamReader Reader = new StreamReader( new WebClient().OpenRead(validateurl));
string resp = Reader.ReadToEnd();
// I like to have the text in memory for debugging rather than parsing the stream
// Some boilerplate to set up the parse.
NameTable nt = new NameTable();
XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt);
XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None);
XmlTextReader reader = new XmlTextReader(resp, XmlNodeType.Element, context);
string netid = null;
// A very dumb use of XML. Just scan for the "user". If it isn't there, its an error.
while (reader.Read())
{
if (reader.IsStartElement()) {
string tag = reader.LocalName;
if (tag=="user")
netid = reader.ReadString();
}
}
// if you want to parse the proxy chain, just add the logic above
reader.Close();
// If there was a problem, leave the message on the screen. Otherwise, return to original page.
if (netid == null)
{
Label1.Text = "CAS returned to this application, but then refused to validate your identity.";
}
else
{
Session["UserName"] = netid;
Label1.Text = "Welcome " + netid;
FormsAuthentication.RedirectFromLoginPage(netid, false); // set netid in ASP.NET blocks
}
}
}
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class MyPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint
, X509Certificate certificate
, WebRequest request
, int certificateProblem) {
//Return True to force the certificate to be accepted.
return true;
} // end CheckValidationResult
} // class MyPolicy
System.Net.ServicePointManager.CertificatePolicy = new MyPolicy();
<!-- ========= Acegi as a CAS Client的酾|?============ --> <bean id="authenticationProcessingFilter" class="org.acegisecurity.ui.cas.CasProcessingFilter"> <property name="authenticationManager" ref="authenticationManager" /> <property name="authenticationFailureUrl" value="/login.do?login_error=1" /> <property name="defaultTargetUrl" value="/main.do" /> <property name="filterProcessesUrl"> <value>/j_acegi_cas_security_check</value> </property> <property name="rememberMeServices" ref="rememberMeServices" /> <property name="exceptionMappings"> <value> org.acegisecurity.AuthenticationServiceException=/login.do?login_error=user_not_found_error org.acegisecurity.BadCredentialsException=/login.do?login_error=user_psw_error org.acegisecurity.concurrent.ConcurrentLoginException=/login.do?login_error=too_many_user_error org.acegisecurity.DisabledException=/login.do?login_error=disabled_user_error </value> </property> </bean> <bean id="exceptionTranslationFilter" class="org.acegisecurity.ui.ExceptionTranslationFilter"> <property name="authenticationEntryPoint"> <ref local="casProcessingFilterEntryPoint"/> </property> <property name="accessDeniedHandler"> <bean class="org.acegisecurity.ui.AccessDeniedHandlerImpl"> <property name="errorPage" value="/errors/accessDenied.jsp" /> </bean> </property> </bean> <!-- cas config --> <bean id="casProcessingFilterEntryPoint" class="org.acegisecurity.ui.cas.CasProcessingFilterEntryPoint"> <property name="loginUrl"><value>https://sso.gzps.net:8443/cas/login</value></property> <property name="serviceProperties"><ref local="serviceProperties"/></property> </bean> <bean id="authenticationManager" class="org.acegisecurity.providers.ProviderManager"> <property name="providers"> <list> <ref local="casAuthenticationProvider"/> </list> </property> </bean> <bean id="casAuthenticationProvider" class="org.acegisecurity.providers.cas.CasAuthenticationProvider"> <property name="casAuthoritiesPopulator"><ref bean="casAuthoritiesPopulator"/></property> <property name="casProxyDecider"><ref local="casProxyDecider"/></property> <property name="ticketValidator"><ref local="casProxyTicketValidator"/></property> <property name="statelessTicketCache"><ref local="statelessTicketCache"/></property> <property name="key"><value>my_password_for_this_auth_provider_only</value></property> </bean> <bean id="casProxyTicketValidator" class="org.acegisecurity.providers.cas.ticketvalidator.CasProxyTicketValidator"> <property name="casValidate"><value>https://sso.gzps.net:8443/cas/proxyValidate</value></property> <property name="serviceProperties"><ref local="serviceProperties"/></property> </bean> <!-- <bean id="casProxyDecider" class="org.acegisecurity.providers.cas.proxy.AcceptAnyCasProxy" /> --> <bean id="casProxyDecider" class="org.acegisecurity.providers.cas.proxy.RejectProxyTickets" /> <bean id="serviceProperties" class="org.acegisecurity.ui.cas.ServiceProperties"> <property name="service"> <value>http://localhost:8080/aio/j_acegi_cas_security_check</value> </property> <property name="sendRenew"> <value>false</value> </property> </bean> <bean id="statelessTicketCache" class="org.acegisecurity.providers.cas.cache.EhCacheBasedTicketCache"> <property name="cache"> <bean class="org.springframework.cache.ehcache.EhCacheFactoryBean"> <property name="cacheManager"> <bean class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"/> </property> <property name="cacheName" value="userCache"/> </bean> </property> </bean> <bean id="casAuthoritiesPopulator" class="org.acegisecurity.providers.cas.populator.DaoCasAuthoritiesPopulator">
<property name="userDetailsService"><ref local="userDetailsService"/></property>
</bean>
<bean id="casProcessingFilter" class="org.acegisecurity.ui.cas.CasProcessingFilter">
<property name="authenticationManager"><ref local="authenticationManager"/></property>
<property name="authenticationFailureUrl"><value>/casfailed.jsp</value></property>
<property name="defaultTargetUrl"><value>/</value></property>
<property name="filterProcessesUrl"><value>/j_acegi_cas_security_check</value></property>
</bean>
<!-- ======================================================= -->
<!-- æ•°æ®æºå®šä¹?-->
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" destroy-method="close">
<property name="driverClassName" value="${db.driver}" />
<property name="url" value="${db.url}" />
<property name="username" value="${db.username}" />
<property name="password" value="${db.password}" />
</bean>
<!--
passwordEncoder 使用Md5½Ž—æ³•åŠ å¯†
-->
<bean id="passwordEncoder"
class="org.jasig.cas.authentication.handler.DefaultPasswordEncoder" autowire="byName">
<constructor-arg value="MD5"/>
</bean>
<!--
<bean
class="org.jasig.cas.authentication.handler.support.SimpleTestUsernamePasswordAuthenticationHandler" />
-->
<bean class="org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler">
<property name="sql" value="select password from CORE_USERS where logid=?" />
<property name="passwordEncoder" ref="passwordEncoder"/>
<property name="dataSource" ref="dataSource" />
</bean>
db.driver=oracle.jdbc.driver.OracleDriver
db.url=jdbc\:oracle\:thin\:@192.168.1.1\:1521\:xxxx
db.username=xxxx
db.password=xxxx
<Connector protocol="org.apache.coyote.http11.Http11Protocol"
port="8443" minSpareThreads="5" maxSpareThreads="75"
enableLookups="true" disableUploadTimeout="true"
acceptCount="100" maxThreads="200"
scheme="https" secure="true" SSLEnabled="true"
keystoreFile="C:/Documents and Settings/Administrator/.keystore" keystorePass="changeit"
truststoreFile="D:/Java/jdk1.6.0_02/jre/lib/security/cacerts"
clientAuth="false" sslProtocol="TLS"/>
<!-- CAS -->
<filter>
<filter-name>CAS Filter</filter-name>
<filter-class>edu.yale.its.tp.cas.client.filter.CASFilter</filter-class>
<init-param>
<param-name>edu.yale.its.tp.cas.client.filter.loginUrl</param-name>
<param-value>https://sso.gzps.net:8443/cas/login</param-value>
</init-param>
<init-param>
<param-name>edu.yale.its.tp.cas.client.filter.validateUrl</param-name>
<param-value>https://sso.gzps.net:8443/cas/serviceValidate</param-value>
</init-param>
<init-param>
<param-name>edu.yale.its.tp.cas.client.filter.serverName</param-name>
<param-value>88.148.29.54:8080</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CAS Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
[/]
#所有目录的è¯Õd–æƒé™
@administrator = rw
@code-developers = r
@core-developers = r
@testers = r
@deployers = r
[code:/src]
#code库ä¸çš„代ç çš„è¯Õd–与更新æƒé™?br />@code-developers = rw
[code:/test-src]
#code库ä¸çš„æµ‹è¯•代ç çš„è¯Õd–与更新æƒé™?br />@code-developers = rw
[code:/resource]
#èµ„æºæ–‡äšg与酾|®æ–‡ä»¶çš„è¯Õd–与更新æƒé™?br />@deployers = rw
[code:/web/biz]
#业务JSP™åµé¢ä»£ç 的读å–与更新æƒé™
@code-developers = rw
[code:/web/common]
#公共模å—JSP™åµé¢ä»£ç 的读å–与更新æƒé™
@core-developers = rw
[code:/web/sysconfig]
#¾pÈ»Ÿé…ç½®JSP™åµé¢ä»£ç 的读å–与更新æƒé™
@core-developers = rw
修改apacheé…置文äšg:httpd.conf
å¢žåŠ ä»¥ä¸‹å†…å®¹:
<Location /svn>
DAV svn
SVNParentPath E:\SVN
AuthType Basic
AuthName "Subversion repository"
AuthUserFile passwd
AuthzSVNAccessFile accesspolicy
Satisfy Any
Require valid-user
</Location>
æ³?å¦‚æžœæœ‰ä¸æ–‡èµ\å¾?ž®†è¯¥æ–‡äšg转æ¢ä¸ºUTF-8¾~–ç æ ¼å¼.
å‚考文ç«?http://www.subversion.org.cn/index.php?option=com_content&task=view&id=78&Itemid=91