广告位联系
返回顶部
分享到

单点登录之cas集成sonar的配置方法介绍

相关技巧 来源:互联网 作者:秩名 发布时间:2022-03-21 21:50:04 人浏览
摘要

一、修改 sonar 配置 conf/sonar.properties 修改 sonar 配置文件 conf/sonar.properties: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 sonar.security.realm = cas sonar.authenticator.createUsers = true #sonar.cas.f

一、修改 sonar 配置 conf/sonar.properties

修改 sonar 配置文件 conf/sonar.properties:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

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 服务。
下载链接:https://github.com/cloudogu/sonar-cas-plugin/releases

在这里插入图片描述

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

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

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

# 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 支持:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

{

  "@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"

  }

}


版权声明 : 本文内容来源于互联网或用户自行发布贡献,该文观点仅代表原作者本人。本站仅提供信息存储空间服务和不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权, 违法违规的内容, 请发送邮件至2530232025#qq.cn(#换@)举报,一经查实,本站将立刻删除。

您可能感兴趣的文章 :

原文链接 : https://blog.csdn.net/u012069313/article/details/120409369
    Tag :
相关文章
  • 本站所有内容来源于互联网或用户自行发布,本站仅提供信息存储空间服务,不拥有版权,不承担法律责任。如有侵犯您的权益,请您联系站长处理!
  • Copyright © 2017-2022 F11.CN All Rights Reserved. F11站长开发者网 版权所有 | 苏ICP备2022031554号-1 | 51LA统计