你好~麻烦截下SonarQube的日志信息
gitlab登录,使用同样的账号可以登录?
sonar的日志如下
2019.07.18 03:06:31 INFO web[AWv/mpr09q3PpTnMABUL][o.s.a.u.HttpConnectionPoolUtil] hostName:api.dongfang.cn
2019.07.18 03:06:32 WARN web[AWv/mpr09q3PpTnMABUM][o.s.s.a.AuthenticationError] Fail to callback authentication with 'choerodon'
com.github.scribejava.core.exceptions.OAuthException: Cannot extract an access token. Response was: {"error":"invalid_client","error_description":"Bad client credentials"}
at com.github.scribejava.core.extractors.JsonTokenExtractor.extractAccessToken(JsonTokenExtractor.java:24)
at com.github.scribejava.core.extractors.JsonTokenExtractor.extract(JsonTokenExtractor.java:15)
at com.github.scribejava.core.oauth.OAuth20ServiceImpl.getAccessToken(OAuth20ServiceImpl.java:37)
at org.sonarqube.auth.choerodonoauth.ChoerodonIdentityProvider.callback(ChoerodonIdentityProvider.java:146)
at org.sonar.server.authentication.OAuth2CallbackFilter.handleOAuth2Provider(OAuth2CallbackFilter.java:97)
at org.sonar.server.authentication.OAuth2CallbackFilter.handleProvider(OAuth2CallbackFilter.java:77)
at org.sonar.server.authentication.OAuth2CallbackFilter.doFilter(OAuth2CallbackFilter.java:70)
at org.sonar.server.platform.web.MasterServletFilter$GodFilterChain.doFilter(MasterServletFilter.java:126)
at org.sonar.server.platform.web.MasterServletFilter.doFilter(MasterServletFilter.java:95)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.sonar.server.user.UserSessionFilter.doFilter(UserSessionFilter.java:87)
at org.sonar.server.user.UserSessionFilter.doFilter(UserSessionFilter.java:71)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.sonar.server.platform.web.CacheControlFilter.doFilter(CacheControlFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.sonar.server.platform.web.SecurityServletFilter.doHttpFilter(SecurityServletFilter.java:76)
at org.sonar.server.platform.web.SecurityServletFilter.doFilter(SecurityServletFilter.java:48)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.sonar.server.platform.web.RedirectFilter.doFilter(RedirectFilter.java:61)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.sonar.server.platform.web.requestid.RequestIdFilter.doFilter(RequestIdFilter.java:63)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.sonar.server.platform.web.RootFilter.doFilter(RootFilter.java:62)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at ch.qos.logback.access.tomcat.LogbackValve.invoke(LogbackValve.java:256)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
在猪齿鱼的开发控制台上可以从仓库地址跳转到gitlab, 但是在猪齿鱼的代码质量管理页面点击项目的报告就跳转不过去,LDAP是没有问题的。
您好,可能是client没有配置正确,参考下这个问题
这个已经改过了,不是这个问题。sonar的日志是什么问题?
还能继续帮忙看一下么?
麻烦手动使用授权码模式认证下;步骤如下:
1)将soanr 客户端的重定向地址,改为https://www.baidu.com/
2)在浏览器中调用访问,会获取到一个code
http://api.xxxx.xxxx.com/oauth/oauth/authorize?client_id=sonar&redirect_uri=https://www.baidu.com/&response_type=code
3)使用postman获取token
http://api.xxxx.xxxx.com/oauth/oauth/token?grant_type=authorization_code&code=s95m7m&client_id=sonar&client_secret=sonarsonar&redirect_uri=https://www.baidu.com/
第一步:修改数据库
mysql> update oauth_client set WEB_SERVER_REDIRECT_URI='https://www.baidu.com' where name='sonar';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select * from oauth_client where name='sonar';
+----+-------+-----------------+--------------+--------+---------+-----------------------------------------------------------------------+-------------------------+-----------------------+------------------------+------------------------+--------------+-----------------------+------------+---------------------+-----------------+---------------------+
| ID | NAME | ORGANIZATION_ID | RESOURCE_IDS | SECRET | SCOPE | AUTHORIZED_GRANT_TYPES | WEB_SERVER_REDIRECT_URI | ACCESS_TOKEN_VALIDITY | REFRESH_TOKEN_VALIDITY | ADDITIONAL_INFORMATION | AUTO_APPROVE | OBJECT_VERSION_NUMBER | CREATED_BY | CREATION_DATE | LAST_UPDATED_BY | LAST_UPDATE_DATE |
+----+-------+-----------------+--------------+--------+---------+-----------------------------------------------------------------------+-------------------------+-----------------------+------------------------+------------------------+--------------+-----------------------+------------+---------------------+-----------------+---------------------+
| 6 | sonar | 1 | default | secret | default | password,implicit,client_credentials,authorization_code,refresh_token | https://www.baidu.com | 3600 | 3600 | {} | default | 1 | 0 | 2019-07-17 09:32:33 | 0 | 2019-07-17 09:32:33 |
+----+-------+-----------------+--------------+--------+---------+-----------------------------------------------------------------------+-------------------------+-----------------------+------------------------+------------------------+--------------+-----------------------+------------+---------------------+-----------------+---------------------+
1 row in set (0.02 sec)
第二步:返回结果为
https://www.baidu.com/?code=yADr7P
第三步: postman测试
改成一致后还是这个错误
1.你的重定向地址也不对,
2.secret和重定向地址都要和数据库一致,你再试一次
麻烦再查询下select * from oauth_client where name='sonar’这个
mysql> use iam_service;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select * from oauth_client where name='sonar';
+----+-------+-----------------+--------------+--------+---------+-----------------------------------------------------------------------+-------------------------+-----------------------+------------------------+------------------------+--------------+-----------------------+------------+---------------------+-----------------+---------------------+
| ID | NAME | ORGANIZATION_ID | RESOURCE_IDS | SECRET | SCOPE | AUTHORIZED_GRANT_TYPES | WEB_SERVER_REDIRECT_URI | ACCESS_TOKEN_VALIDITY | REFRESH_TOKEN_VALIDITY | ADDITIONAL_INFORMATION | AUTO_APPROVE | OBJECT_VERSION_NUMBER | CREATED_BY | CREATION_DATE | LAST_UPDATED_BY | LAST_UPDATE_DATE |
+----+-------+-----------------+--------------+--------+---------+-----------------------------------------------------------------------+-------------------------+-----------------------+------------------------+------------------------+--------------+-----------------------+------------+---------------------+-----------------+---------------------+
| 6 | sonar | 1 | default | secret | default | password,implicit,client_credentials,authorization_code,refresh_token | https://www.baidu.com | 3600 | 3600 | {} | default | 1 | 0 | 2019-07-17 09:32:33 | 0 | 2019-07-17 09:32:33 |
+----+-------+-----------------+--------------+--------+---------+-----------------------------------------------------------------------+-------------------------+-----------------------+------------------------+------------------------+--------------+-----------------------+------------+---------------------+-----------------+---------------------+
1 row in set (0.00 sec)