單點(diǎn)登錄之cas集成sonar的配置方法
一、修改 sonar 配置 conf/sonar.properties
修改 sonar 配置文件 conf/sonar.properties:
sonar.security.realm = cas
sonar.authenticator.createUsers = true
#sonar.cas.forceCasLogin = true
sonar.cas.protocol = cas3
sonar.cas.casServerUrlPrefix = http://192.168.1.58:8080/cas
sonar.cas.casServerLoginUrl = http://192.168.1.58:8080/cas/login
sonar.cas.casServerLogoutUrl = http://192.168.1.58:8080/cas/logout
sonar.cas.sonarServerUrl = http://192.168.1.35:9200
sonar.cas.urlAfterCasRedirectCookieMaxAgeSeconds = 300
sonar.cas.sessionStorePath = /opt/sonarqube/data/sonarcas/sessionstore
sonar.cas.sessionStore.cleanUpIntervalInSeconds = 1800
# Specifies whether gateway=true should be sent to the CAS server. Default is false.
# sonar.cas.sendGateway
# Specifies how SonarQube groups should be replicated. A value of "CAS" always overwrites the user's local groups with
# the group provided by CAS upon UI log-in. The user's local groups will be untouched, f. i. with the value "sonarqube".
# Defaults to "CAS".
sonar.cas.groupReplication = CAS
sonar.cas.rolesAttributes = groups
sonar.cas.fullNameAttribute = displayName
sonar.cas.eMailAttribute = mail
sonar.cas.saml11.toleranceMilliseconds = 1000
sonar.cas.disableCertValidation = true
二、下載插件 sonar-cas-plugin
下載插件 sonar-cas-plugin,將插件拷貝至 sonar 的 extentions/plugins 目錄下,并重啟 sonar 服務(wù)。
下載鏈接:https://github.com/cloudogu/sonar-cas-plugin/releases

三、修改 cas 配置文件 application.yml
修改 cas 配置文件 application.yml,修改內(nèi)容如下:
# Application properties that need to be
# embedded within the web application can be included here
cas:
authn:
jdbc:
query:
- dialect: org.hibernate.dialect.MySQLDialect
driverClass: com.mysql.jdbc.Driver
fieldPassword: password
password: 'xxxxxx'
sql: select * from user where user_name=?
url: jdbc:mysql://192.168.1.32:3306/cas?useUnicode=true&characterEncoding=utf-8&useSSL=false
user: root
serviceRegistry:
initFromJson: true
tgc:
secure: false四、修改 cas 配置文件 HTTPSandIMAPS-10000001.json
新增 cas/WEB-INF/classes/services/HTTPSandIMAPS-10000001.json 文件,添加 http 支持:
{
"@class" : "org.apereo.cas.services.RegexRegisteredService",
"serviceId" : "^(https?|http?|imaps?)://.*",
"name" : "All",
"id" : 10000000,
"description" : "This service definition authorizes all application urls that support HTTPS and IMAPS protocols.",
"evaluationOrder" : 10000,
"proxyPolicy" : {
"@class" : "org.apereo.cas.services.RegexMatchingRegisteredServiceProxyPolicy",
"pattern" : "^(https?|http?|imaps?)://.*"
},
"usernameAttributeProvider" : {
"@class" : "org.apereo.cas.services.DefaultRegisteredServiceUsernameProvider"
},
"attributeReleasePolicy" : {
"@class" : "org.apereo.cas.services.ReturnAllAttributeReleasePolicy"
}
}
到此這篇關(guān)于單點(diǎn)登錄之cas集成sonar的文章就介紹到這了,更多相關(guān)cas集成sonar內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
npm script 的文件監(jiān)聽和自動(dòng)刷新的命令詳解
文件監(jiān)聽的作用是為了實(shí)現(xiàn)自動(dòng)化,釋放雙手和精力,提高效率,讓開發(fā)者更加關(guān)注于開發(fā)。這篇文章主要介紹了npm script 的文件監(jiān)聽和自動(dòng)刷新,需要的朋友可以參考下2019-06-06
Application,Session,Cookies對象應(yīng)用介紹
Application,Session,Cookies對象比較,對于客戶端保存登錄信息的朋友可以參考下。2011-05-05
Sublime將數(shù)據(jù)json格式化的操作方法
這篇文章主要介紹了Sublime將數(shù)據(jù)json格式化的操作方法,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2023-06-06
git 配置多個(gè)SSH-Key實(shí)現(xiàn)示例
這篇文章主要為大家介紹了git 配置多個(gè)SSH-Key實(shí)現(xiàn)示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-07-07
chatGPT與傳統(tǒng)搜索結(jié)合創(chuàng)建新一代搜索引擎
這篇文章主要為大家介紹了chatGPT與傳統(tǒng)搜索結(jié)合創(chuàng)建新一代搜索引擎優(yōu)點(diǎn)詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-01-01

