CAS (단일 로그 인) --- 총괄 1
1. 최근 한 동안 회사 가 시스템 통합 을 실시 하여 회 사 는 Yle cas 단일 로그 인 으로 통합 하기 로 결 정 했 습 니 다. 여기 서 프로젝트 통합 에서 발생 한 문 제 를 정리 하기 로 결 정 했 습 니 다.
1, 공식 다운로드 CAS2. x 서버 이름 변경 ssoAuth
2. ssoAuth / login 을 모든 시스템 의 로그 인 페이지 로 하고 각 시스템 을 설정 합 니 다. 설정 은 다음 과 같 습 니 다.
이 글 을 볼 수 있 습 니 다.
3. 로그 인 한 후에 문제 가 발생 하면 다시 로그 인 페이지 로 돌아 가 는 것 입 니 다. (로그 인 한 후에 CASTGC 의 쿠키 가 생 길 수 있 습 니 다)
해결:
ssoAuth / WebContent / spring - configuration / ticket GrantingTicketCookieGenerator. xml 의 p: cookiePath = "/ ssoAuth" 변경 warnCookieGenerator. xml 의 p: cookiePath = "/ ssoAuth" 와 로그 인 이름 이 바 뀌 었 기 때문에 cookie path 설정 값 이 변경 되 지 않 았 습 니 다. 검증 시 catgc 의 쿠키 를 가 져 올 수 없습니다.
4. ssoAuth / login 으로 이동 하지 않 고 다음 시스템 마다 로그 인 페이지 를 사용자 정의 합 니 다.
이 안의 세 편의 문장 을 볼 수 있다.
5, 대리 문제
대리 가 해결 할 수 있 는 문제:
한 시스템 1 이 다른 시스템 2 의 데 이 터 를 찾 으 러 가 려 고 할 때 두 대 는 같은 컴퓨터 에 있 지 않 고 이 두 개 는 동시에 단일 로그 인 에 추가 되 었 습 니 다. 이때 1 시스템 이 로그 인하 여 2 시스템 의 데 이 터 를 찾 으 러 가 려 고 할 때 2 시스템 이 로그 인하 지 않 았 을 때 데 이 터 를 찾 을 수 없 습 니까?
이 럴 때 대리 가 도움 이 된다. 대리 어음 의 생 성
http://129-cat-163-com.iteye.com/blog/477506
해결:
이 글 을 먼저 볼 수 있 습 니 다.
다음 과 같이 상세 하 게 설명 한다.
ssoProxyClient (프 록 시) ssoProxyBackClient (피 프 록 시) ssoAuth 에서 모두 설정 해 야 합 니 다.
ssoAuth: 통합 할 때 문 제 를 발 견 했 습 니 다. 원본 코드 를 찾 습 니 다. 클 라 이언 트 설정 이 올 바 르 고 대리 어음 을 되 돌려 주지 않 습 니 다.
deployerConfigContext. xml 에서 설정
httpClient
<bean
class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler"
p:httpClient-ref="httpClient" p:requireSecure="false" />
프 록 시 측 과 피 프 록 시 측 모두 설정 (설정 이 길 고 일일이 소개 하지 않 음) 연락 처 를 남 겨 야 합 니 다. 제 가 보 내 드 리 겠 습 니 다.
7. 대리 성능 문제 해결:
상기 문제 에서 보 듯 이 시스템 2 는 프 록 시 시스템 이 되 었 습 니 다. 프 록 시 시스템 1 은 프 록 시 서버 에 가서 어음 을 한 번 찾 은 후에 시스템 2 로 전 달 됩 니 다. 이때 시스템 2 도 서버 에 가서 검 증 된 프 록 시 어음 을 찾 아 비교 해 야 합 니 다.
이렇게 되면 매번 서버 와 두 번 통신 해 야 하 며, 성능 소모 가 매우 크다. 안전성 을 고려 하지 않 는 전제 에서 쌍방 에 게 어음 하 나 를 저장 할 수 있다. 이렇게 되면 몇 번 을 방문 하 든 서버 에서 두 번 만 통신 할 수 있다.
저 는 상기 대리 와 피 대리 시스템 을 확 장 했 습 니 다. 마찬가지 로) 연락 처 를 남 겨 야 합 니 다. 제 가 보 내 드 리 겠 습 니 다.
8. 클 라 이언 트 는 더 많은 사용자 데 이 터 를 되 돌려 줄 수 있 습 니 다. 이것 은 두 가지 설정 이 있 습 니 다.
다음은 비교적 완전한 deployerConfigContext. xml 설정 을 제공 합 니 다. 일반적으로 이 안에 유용 합 니 다.
<!--
| deployerConfigContext.xml centralizes into one file some of the
declarative configuration that | all CAS deployers will need to
modify. | | This file declares some of the Spring-managed JavaBeans
that make up a CAS deployment. | The beans declared in this file are
instantiated at context initialization time by the Spring |
ContextLoaderListener declared in web.xml. It finds this file because
this | file is among those declared in the context parameter
"contextConfigLocation". | | By far the most common change you will
need to make in this file is to change the last bean | declaration to
replace the default SimpleTestUsernamePasswordAuthenticationHandler
with | one implementing your approach for authenticating usernames and
passwords. +
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<!--
cas 。
-->
<bean id="casDataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName">
<value>net.sourceforge.jtds.jdbc.Driver</value>
</property>
<property name="url">
<value>jdbc:jtds:sqlserver://192.168.4.22:3433/db</value>
</property>
<property name="username">
<value>****</value>
</property>
<property name="password">
<value>****</value>
</property>
</bean>
<bean id="passwordEncoder"
class="org.jasig.cas.authentication.handler.DefaultPasswordEncoder"
autowire="byName">
<constructor-arg value="MD5" />
</bean>
<bean id="passwordEncoder2"
class="org.jasig.cas.authentication.handler.PlainTextPasswordEncoder">
</bean>
<!--
| This bean declares our AuthenticationManager. The
CentralAuthenticationService service bean | declared in
applicationContext.xml picks up this AuthenticationManager by
reference to its id, | "authenticationManager". Most deployers will be
able to use the default AuthenticationManager | implementation and so
do not need to change the class of this bean. We include the whole |
AuthenticationManager here in the userConfigContext.xml so that you
can see the things you will | need to change in context. +
-->
<bean id="authenticationManager" class="org.jasig.cas.authentication.AuthenticationManagerImpl">
<!--
| This is the List of CredentialToPrincipalResolvers that identify
what Principal is trying to authenticate. | The
AuthenticationManagerImpl considers them in order, finding a
CredentialToPrincipalResolver which | supports the presented
credentials. | | AuthenticationManagerImpl uses these resolvers for
two purposes. First, it uses them to identify the Principal |
attempting to authenticate to CAS /login . In the default
configuration, it is the DefaultCredentialsToPrincipalResolver | that
fills this role. If you are using some other kind of credentials than
UsernamePasswordCredentials, you will need to replace |
DefaultCredentialsToPrincipalResolver with a
CredentialsToPrincipalResolver that supports the credentials you are
| using. | | Second, AuthenticationManagerImpl uses these resolvers
to identify a service requesting a proxy granting ticket. | In the
default configuration, it is the
HttpBasedServiceCredentialsToPrincipalResolver that serves this
purpose. | You will need to change this list if you are identifying
services by something more or other than their callback URL. +
-->
<property name="credentialsToPrincipalResolvers">
<list>
<!--
| UsernamePasswordCredentialsToPrincipalResolver supports the
UsernamePasswordCredentials that we use for /login | by default and
produces SimplePrincipal instances conveying the username from the
credentials. | | If you've changed your LoginFormAction to use
credentials other than UsernamePasswordCredentials then you will
also | need to change this bean declaration (or add additional
declarations) to declare a CredentialsToPrincipalResolver that
supports the | Credentials you are using. +
-->
<bean
class="org.jasig.cas.authentication.principal.UsernamePasswordCredentialsToPrincipalResolver">
<property name="attributeRepository">
<ref local="attributeRepository" />
</property>
</bean>
<!--
| HttpBasedServiceCredentialsToPrincipalResolver supports
HttpBasedCredentials. It supports the CAS 2.0 approach of |
authenticating services by SSL callback, extracting the callback
URL from the Credentials and representing it as a | SimpleService
identified by that callback URL. | | If you are representing
services by something more or other than an HTTPS URL whereat they
are able to | receive a proxy callback, you will need to change
this bean declaration (or add additional declarations). +
-->
<bean
class="org.jasig.cas.authentication.principal.HttpBasedServiceCredentialsToPrincipalResolver" />
</list>
</property>
<!--
| Whereas CredentialsToPrincipalResolvers identify who it is some
Credentials might authenticate, | AuthenticationHandlers actually
authenticate credentials. Here we declare the AuthenticationHandlers
that | authenticate the Principals that the
CredentialsToPrincipalResolvers identified. CAS will try these
handlers in turn | until it finds one that both supports the
Credentials presented and succeeds in authenticating. +
-->
<property name="authenticationHandlers">
<list>
<!-- , , , -->
<!-- support EAP database -->
<bean
class="org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler">
<property name="dataSource" ref="casDataSource" />
<property name="sql"
value="SELECT Password FROM table1 WHERE Id = ?" />
<property name="passwordEncoder" ref="passwordEncoder" />
</bean>
<!-- support another user table, , -->
<bean
class="com.wqy.sso.auth.QueryDatabaseAuthenticationHandler2">
<property name="dataSource" ref="casDataSource" />
<property name="sql"
value="SELECT FGUID FROM table2 WHERE FUserID = ? and cast(ID as varchar(50))=?" />
<!-- -->
<property name="passwordEncoder" ref="passwordEncoder2" />
</bean>
<!--
| This is the authentication handler that authenticates services by
means of callback via SSL, thereby validating | a server side SSL
certificate. +
-->
<bean
class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler"
p:httpClient-ref="httpClient" p:requireSecure="false" />
<!--
| This is the authentication handler declaration that every CAS
deployer will need to change before deploying CAS | into
production. The default
SimpleTestUsernamePasswordAuthenticationHandler authenticates
UsernamePasswordCredentials | where the username equals the
password. You will need to replace this with an
AuthenticationHandler that implements your | local authentication
strategy. You might accomplish this by coding a new such handler
and declaring | edu.someschool.its.cas.MySpecialHandler here, or
you might use one of the handlers provided in the adaptors modules.
+
<bean
class="org.jasig.cas.authentication.handler.support.SimpleTestUsernamePasswordAuthenticationHandler" />
-->
</list>
</property>
</bean>
<!--
This bean defines the security roles for the Services Management
application. Simple deployments can use the in-memory version. More
robust deployments will want to use another option, such as the Jdbc
version. The name of this should remain "userDetailsService" in order
for Acegi to find it. To use this, you should add an entry similar to
the following between the two value tags: battags=notused,ROLE_ADMIN
where battags is the username you want to grant access to. You can put
one entry per line.
-->
<bean id="userDetailsService"
class="org.springframework.security.userdetails.memory.InMemoryDaoImpl">
<property name="userMap">
<value>
</value>
</property>
</bean>
<!--
Bean that defines the attributes that a service may return. This
example uses the Stub/Mock version. A real implementation may go
against a database or LDAP server. The id should remain
"attributeRepository" though.
,
-->
<bean id="attributeRepository"
class="org.jasig.services.persondir.support.jdbc.SingleRowJdbcPersonAttributeDao">
<constructor-arg index="0" ref="casDataSource" />
<constructor-arg index="1"
value="SELECT FBy5 AS type,deptId,id,position FROM table WHERE Fid=?" />
<property name="queryAttributeMapping">
<map>
<!--
username: uid: fid
-->
<entry key="username" value="uid" />
</map>
</property>
<property name="resultAttributeMapping">
<map>
<entry key="id" value="id1" />
<entry key="deptId" value="dept1" />
<entry key="Position" value="position1"/>
<entry key="type" value="type1" />
</map>
</property>
</bean>
<!--
Sample, in-memory data store for the ServiceRegistry. A real
implementation would probably want to replace this with the JPA-backed
ServiceRegistry DAO The name of this bean should remain
"serviceRegistryDao".
-->
<bean id="serviceRegistryDao" class="org.jasig.cas.services.InMemoryServiceRegistryDaoImpl" />
</beans>
- - > 다음 장 을 보 세 요.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
thymeleaf로 HTML 페이지를 동적으로 만듭니다 (spring + gradle)지난번에는 에서 화면에 HTML을 표시했습니다. 이번에는 화면을 동적으로 움직여보고 싶기 때문에 입력한 문자를 화면에 표시시키고 싶습니다. 초보자의 비망록이므로 이상한 점 등 있으면 지적 받을 수 있으면 기쁩니다! ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.