搞的一个js鉴权认证,先跳转到 gitlib,登录后跳转到我们公司测试接口的页面;
公司gitlib地址:gitlab.cmread.com
[INFO][2018-12-17 15:29:00,189][com.migu.reading.auditweb.filter.AuditFilter]3E53B9035909B5ACF59E4ABEB8772EC8 get code 32cb5fcecba8c58f7cddb7ec17fca19cdde9e29f4d07610215bd7007f32b3dd0 [INFO][2018-12-17 15:29:00,189][com.migu.reading.auditweb.filter.AuditFilter]build authorize request with code:32cb5fcecba8c58f7cddb7ec17fca19cdde9e29f4d07610215bd7007f32b3dd0 and client secret [ERROR][2018-12-17 15:29:40,500][com.migu.reading.auditweb.filter.AuditFilter]get accessToken failed. org.apache.oltu.oauth2.common.exception.OAuthSystemException: java.net.UnknownHostException: gitlab.cmread.com at org.apache.oltu.oauth2.client.URLConnectionClient.execute(URLConnectionClient.java:108) at org.apache.oltu.oauth2.client.OAuthClient.accessToken(OAuthClient.java:65) at org.apache.oltu.oauth2.client.OAuthClient.accessToken(OAuthClient.java:55) at org.apache.oltu.oauth2.client.OAuthClient.accessToken(OAuthClient.java:71) at com.migu.reading.auditweb.filter.AuditFilter.getGitlabUserInfo(AuditFilter.java:340) at com.migu.reading.auditweb.filter.AuditFilter.callBack(AuditFilter.java:272) at com.migu.reading.auditweb.filter.AuditFilter.doFilter(AuditFilter.java:119) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at com.migu.reading.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:27) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at com.huawei.openas.monitor.valve.RequestCounterValve.invoke(RequestCounterValve.java:128) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.net.UnknownHostException: gitlab.cmread.com at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668) at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173) at sun.net.NetworkClient.doConnect(NetworkClient.java:180) at sun.net.www.http.HttpClient.openServer(HttpClient.java:432) at sun.net.www.http.HttpClient.openServer(HttpClient.java:527) at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264) at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191) at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1105) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:999) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177) at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1283) at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1258) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250) at org.apache.oltu.oauth2.client.URLConnectionClient.execute(URLConnectionClient.java:85) ... 29 more [INFO][2018-12-17 15:29:40,514][com.migu.reading.auditweb.filter.AuditFilter]isNeedAuthorized pattern:/iufs/interfacejsp.* url:/iufs/interfacejsp/ [INFO][2018-12-17 15:29:40,518][com.migu.reading.auditweb.filter.AuditFilter]3E53B9035909B5ACF59E4ABEB8772EC8:{"name":"unknown","id":"0","username":"unknown"} [INFO][2018-12-17 15:29:41,670][com.migu.reading.auditweb.filter.AuditFilter]isNeedLog pattern:/iufs/interfacejsp.* url:/iufs/interfacejsp/ [INFO][2018-12-17 15:29:41,674][com.migu.reading.auditweb.cdr.CDRLog]set cdrlogcdrlog path/home/iufs/apache-tomcat/webapps/iufs/REPORT [INFO][2018-12-17 15:29:41,676][com.migu.reading.auditweb.cdr.CDRLog]Set cdrlog temp pathcdrlog temp path/home/iufs/apache-tomcat/webapps/iufs/REPORT [DEBUG][2018-12-17 15:29:41,676][com.migu.reading.auditweb.cdr.CDRLog]logFileNamePre isOP [INFO][2018-12-17 15:29:41,764][com.migu.reading.auditweb.filter.AuditFilter]isNeedAuthorized pattern:/iufs/interfacejsp.* url:/iufs/interfacejsp/head.html [INFO][2018-12-17 15:29:41,765][com.migu.reading.auditweb.filter.AuditFilter]3E53B9035909B5ACF59E4ABEB8772EC8:{"remoteIP":"10.73.158.228","rspStr":"status=0","name":"unknown","rspTime":"1545031781670","id":"0","reqTime":"1545031780519","url":"/iufs/interfacejsp/","username":"unknown"} [INFO][2018-12-17 15:29:41,769][com.migu.reading.auditweb.filter.AuditFilter]isNeedLog pattern:/iufs/interfacejsp.* url:/iufs/interfacejsp/head.html [INFO][2018-12-17 15:29:42,268][com.migu.reading.auditweb.filter.AuditFilter]isNeedAuthorized pattern:/iufs/interfacejsp.* url:/iufs/interfacejsp/send.jsp [INFO][2018-12-17 15:29:42,268][com.migu.reading.auditweb.filter.AuditFilter]3E53B9035909B5ACF59E4ABEB8772EC8:{"remoteIP":"10.73.158.228","rspStr":"status=0;Accept-Ranges=bytes;ETag=W/"350-1534325362000";Last-Modified=Wed, 15 Aug 2018 09:29:22 GMT","name":"unknown","rspTime":"1545031781768","id":"0","reqTime":"1545031781765","url":"/iufs/interfacejsp/head.html","username":"unknown"} [INFO][2018-12-17 15:29:42,270][com.migu.reading.auditweb.filter.AuditFilter]isNeedAuthorized pattern:/iufs/interfacejsp.* url:/iufs/interfacejsp/actions.jsp [INFO][2018-12-17 15:29:42,272][com.migu.reading.auditweb.filter.AuditFilter]3E53B9035909B5ACF59E4ABEB8772EC8:{"remoteIP":"10.73.158.228","rspStr":"status=0;Accept-Ranges=bytes;ETag=W/"350-1534325362000";Last-Modified=Wed, 15 Aug 2018 09:29:22 GMT","name":"unknown","rspTime":"1545031781768","id":"0","reqTime":"1545031781765","url":"/iufs/interfacejsp/head.html","username":"unknown"} [INFO][2018-12-17 15:29:42,486][com.migu.reading.auditweb.filter.AuditFilter]isNeedLog pattern:/iufs/interfacejsp.* url:/iufs/interfacejsp/send.jsp [INFO][2018-12-17 15:29:42,645][com.migu.reading.auditweb.filter.AuditFilter]isNeedLog pattern:/iufs/interfacejsp.* url:/iufs/interfacejsp/actions.jsp
大概意思就是无法解析gitlib的域名;
解决方法有两种:
1、辑etc下的resoly.conf文件(如果没有就新建一个)
vi /etc/resolv.conf
添加一行配置:
nameserver 8.8.8.8
保存修改的配置,重启网络服务;
service network restart
这样就可以了。
2、修改linux的hosts配置,添加配置项;
hosts文件在etc下;
vi /etc/hosts
在hosts文件里配置一个gitlib的映射;
112.13.170.217 gitlab.cmread.com
重启服务即可;