温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

cas集成sonar怎么配置

发布时间:2022-03-21 15:36:01 来源:亿速云 阅读:385 作者:iii 栏目:开发技术

本篇内容主要讲解“cas集成sonar怎么配置”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“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 服务。

cas集成sonar怎么配置

三、修改 cas 配置文件 application.yml

修改 cas 配置文件 application.yml,修改内容如下:

                                                         # 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"
  }
}

到此,相信大家对“cas集成sonar怎么配置”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI