{"id":239169,"date":"2022-04-11T09:08:23","date_gmt":"2022-04-11T01:08:23","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=239169"},"modified":"2022-03-29T12:09:08","modified_gmt":"2022-03-29T04:09:08","slug":"cas-sonar-linux","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/cas-sonar-linux.html","title":{"rendered":"\u5355\u70b9\u767b\u5f55\u4e4bcas\u96c6\u6210sonar\u7684\u914d\u7f6e\u65b9\u6cd5\u8be6\u89e3"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u8fd9\u7bc7\u6587\u7ae0\u4e3b\u8981\u4ecb\u7ecd\u4e86\u5355\u70b9\u767b\u5f55\u4e4bcas\u96c6\u6210sonar\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u672c\u6587\u901a\u8fc7\u793a\u4f8b\u4ee3\u7801\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u7684\u975e\u5e38\u8be6\u7ec6\uff0c\u5bf9\u5927\u5bb6\u7684\u5b66\u4e60\u6216\u5de5\u4f5c\u5177\u6709\u4e00\u5b9a\u7684\u53c2\u8003\u501f\u9274\u4ef7\u503c,\u9700\u8981\u7684\u670b\u53cb\u53ef\u4ee5\u53c2\u8003\u4e0b<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u4e00\u3001\u4fee\u6539 sonar \u914d\u7f6e conf\/sonar.properties<\/strong><\/div>\n

\u4fee\u6539 sonar \u914d\u7f6e\u6587\u4ef6 conf\/sonar.properties\uff1a<\/p>\n

sonar.security.realm = cas                                                                                                                                                                                                                                                                            \r\nsonar.authenticator.createUsers = true                                                                                                              \r\n#sonar.cas.forceCasLogin = true                                                                                                                     \r\nsonar.cas.protocol = cas3                                                                                                                           \r\nsonar.cas.casServerUrlPrefix = http:\/\/192.168.1.58:8080\/cas                                                                                         \r\nsonar.cas.casServerLoginUrl = http:\/\/192.168.1.58:8080\/cas\/login                                                                    \r\nsonar.cas.casServerLogoutUrl = http:\/\/192.168.1.58:8080\/cas\/logout                                                                  \r\nsonar.cas.sonarServerUrl = http:\/\/192.168.1.35:9200                                              \r\nsonar.cas.urlAfterCasRedirectCookieMaxAgeSeconds = 300            \r\nsonar.cas.sessionStorePath = \/opt\/sonarqube\/data\/sonarcas\/sessionstore        \r\nsonar.cas.sessionStore.cleanUpIntervalInSeconds = 1800                                    \r\n                                                                                               \r\n# Specifies whether gateway=true should be sent to the CAS server. Default is false.                                                \r\n# sonar.cas.sendGateway                                                                       \r\n                                                                                     \r\n# Specifies how SonarQube groups should be replicated. A value of \"CAS\" always overwrites the user's local groups with                     \r\n# the group provided by CAS upon UI log-in. The user's local groups will be untouched, f. i. with the value \"sonarqube\".\r\n# Defaults to \"CAS\".                                                                                                    \r\nsonar.cas.groupReplication = CAS                                                                                                   \r\nsonar.cas.rolesAttributes = groups                                                                                      \r\nsonar.cas.fullNameAttribute = displayName                                                                               \r\nsonar.cas.eMailAttribute = mail                                                                                                                    \r\nsonar.cas.saml11.toleranceMilliseconds = 1000                                                                           \r\nsonar.cas.disableCertValidation = true   <\/pre>\n
\u4e8c\u3001\u4e0b\u8f7d\u63d2\u4ef6 sonar-cas-plugin<\/strong><\/div>\n

\u4e0b\u8f7d\u63d2\u4ef6 sonar-cas-plugin\uff0c\u5c06\u63d2\u4ef6\u62f7\u8d1d\u81f3 sonar \u7684 extentions\/plugins \u76ee\u5f55\u4e0b\uff0c\u5e76\u91cd\u542f sonar \u670d\u52a1\u3002<\/p>\n

\u4e0b\u8f7d\u94fe\u63a5\uff1ahttps:\/\/github.com\/cloudogu\/sonar-cas-plugin\/releases<\/p>\n

\"\"<\/p>\n

\u4e09\u3001\u4fee\u6539 cas \u914d\u7f6e\u6587\u4ef6 application.yml<\/strong><\/div>\n

\u4fee\u6539 cas \u914d\u7f6e\u6587\u4ef6 application.yml\uff0c\u4fee\u6539\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n

\r\n# Application properties that need to be\r\n# embedded within the web application can be included here\r\ncas:\r\n  authn:\r\n    jdbc:\r\n      query:\r\n      - dialect: org.hibernate.dialect.MySQLDialect\r\n        driverClass: com.mysql.jdbc.Driver\r\n        fieldPassword: password\r\n        password: 'xxxxxx'\r\n        sql: select * from user where user_name=?\r\n        url: jdbc:mysql:\/\/192.168.1.32:3306\/cas?useUnicode=true&characterEncoding=utf-8&useSSL=false\r\n        user: root\r\n  serviceRegistry:\r\n    initFromJson: true\r\n  tgc:\r\n    secure: false<\/pre>\n
\u56db\u3001\u4fee\u6539 cas \u914d\u7f6e\u6587\u4ef6 HTTPSandIMAPS-10000001.json<\/strong><\/div>\n

\u65b0\u589e cas\/WEB-INF\/classes\/services\/HTTPSandIMAPS-10000001.json \u6587\u4ef6\uff0c\u6dfb\u52a0 http \u652f\u6301\uff1a<\/p>\n

\r\n{\r\n  \"@class\" : \"org.apereo.cas.services.RegexRegisteredService\",\r\n  \"serviceId\" : \"^(https?|http?|imaps?):\/\/.*\",\r\n  \"name\" : \"All\",\r\n  \"id\" : 10000000,\r\n  \"description\" : \"This service definition authorizes all application urls that support HTTPS and IMAPS protocols.\",\r\n  \"evaluationOrder\" : 10000,\r\n  \"proxyPolicy\" : {\r\n    \"@class\" : \"org.apereo.cas.services.RegexMatchingRegisteredServiceProxyPolicy\",\r\n    \"pattern\" : \"^(https?|http?|imaps?):\/\/.*\"\r\n  },\r\n  \"usernameAttributeProvider\" : {\r\n    \"@class\" : \"org.apereo.cas.services.DefaultRegisteredServiceUsernameProvider\"\r\n  },\r\n  \"attributeReleasePolicy\" : {\r\n    \"@class\" : \"org.apereo.cas.services.ReturnAllAttributeReleasePolicy\"\r\n  }\r\n}<\/pre>\n

\u5230\u6b64\u8fd9\u7bc7\u5173\u4e8e\u5355\u70b9\u767b\u5f55\u4e4bcas\u96c6\u6210sonar\u7684\u6587\u7ae0\u5c31\u4ecb\u7ecd\u5230\u8fd9\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u4fee\u6539 sonar \u914d\u7f6e\u6587\u4ef6 conf\/sonar.properties\uff1a sonar.security.rea […]<\/p>\n","protected":false},"author":668,"featured_media":130711,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-239169","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/239169","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/668"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=239169"}],"version-history":[{"count":4,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/239169\/revisions"}],"predecessor-version":[{"id":239174,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/239169\/revisions\/239174"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/130711"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=239169"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=239169"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=239169"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}