小编Run*_*orn的帖子

SSL证书验证:javax.net.ssl.SSLHandshakeException

我试图通过调用HTTPS REST API Jersey Client.在开发过程中,我偶然发现了以下错误:

Exception in thread "main" com.sun.jersey.api.client.ClientHandlerException: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No name matching mvn.signify.abc.com found
    at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:149)
    at com.sun.jersey.api.client.Client.handle(Client.java:648)
    at com.sun.jersey.api.client.WebResource.handle(WebResource.java:670)
    at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
    at com.sun.jersey.api.client.WebResource$Builder.get(WebResource.java:503)
    at com.lftechnology.sbworkbench.utility.utils.PingFederateUtility.main(PingFederateUtility.java:32)
Caused by: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No name matching mvn.signify.abc.com found
Run Code Online (Sandbox Code Playgroud)

所以我用Google搜索了一下,发现了大量的解决方案,实际上是有效的.

  1. 使用Jersey客户端的HTTPS
  2. https://gist.github.com/outbounder/1069465
  3. 如何修复"java.security.cert.CertificateException:没有主题替代名称出现"错误?
  4. http://www.mkyong.com/webservices/jax-ws/java-security-cert-certificateexception-no-name-matching-localhost-found/
  5. http://java.globinch.com/enterprise-java/security/fix-java-security-certificate-exception-no-matching-localhost-found/

他们处于不同的领域,但他们有一个共同的解决方案来解决它.

脚本

我目前在开发环境中使用自创的自签名证书.因此它必然会出现问题.

上述解决方案侧重于跳过/允许验证所有证书.

但是当我将它移动到生产环境时,我可以从可信赖的来源访问有效签名证书.

  1. 当我转向生产时,这些解决方案是否有任何帮助?
  2. 可以跳过SSL验证吗?
  3. 为开发和生产环境实现通用解决方案的另一种替代方法是什么?

PS

我使用的解决方案是,

try
{
    // Create a trust manager that does not validate certificate chains
    TrustManager[] trustAllCerts = new TrustManager[] {new X509TrustManager() {
        public java.security.cert.X509Certificate[] getAcceptedIssuers() …
Run Code Online (Sandbox Code Playgroud)

java security ssl https

8
推荐指数
2
解决办法
2万
查看次数

使用自定义值验证地图

我有以下地图:

Map<String, MyCustomObject>
Run Code Online (Sandbox Code Playgroud)

我的目标是使用hamcrest匹配器验证此映射的容量.我尝试过以下方法:

assertThat(map, hasEntry("key", (MyCustomObject)hasItem(hasProperty("propertyName", equalTo("value")))));
Run Code Online (Sandbox Code Playgroud)

但看起来该hasItem方法仅适用于集合.

有没有其他方法可以验证自定义对象?

new MyCustomObject()在我的情况下不起作用,因为测试因hashcode相等而失败.而另一件事是我无法修改MyCustomObject class.

java junit hamcrest

7
推荐指数
0
解决办法
512
查看次数

PingFederate IdP发起的Logout,重定向到TargetResource

Ping Ping Federate从IdP流注销,从Ping Federate 文档开始

序列

  1. 用户启动单个注销请求.该请求以PingFederate服务器的/idp/startSLO.ping端点为目标.

  2. PingFederate发送注销请求并接收来自为当前SSO会话注册的所有SP的响应.

  3. PingFederate将请求重定向到IdP Web应用程序的Logout Service,该服务在本地标识和删除用户的会话.

  4. 应用程序Logout Service重定向回PingFederate以显示注销成功页面.

但是,我对应用程序Logout Service有一点问题 ,需要在IdP适配器配置中设置.

问题是我有动态注销URL,因此我无法在注销服务中使用它.

目前我正在尝试初始化IdP发起的SLO.TargetResource在SLO成功之后,我正在为此将用户重定向到IdP.

https://idp.pf.com:9031/idp/startSLO.ping?PartnerSpId=testSpId&TargetResource=http%3A%2F%2Fdynamicsubhost.baseurl.com%3A8080%2Fweb%2Fmy-bank%2Flogout
Run Code Online (Sandbox Code Playgroud)

题 :

那么我怎样才能使PingFederate设置跳过Step 3,所以不是重定向到IdP Logout service它重定向到TargetResource.

我尝试过的:

我知道这听起来很俗气,但实际上我将IdP注销服务保持为空白.但显然它没有用.

PS尴尬的是,当我使用相同的PF服务器配置IdP和SP服务器时,它运行良好.但是,当我切换到单独的PF服务器实例来托管PingFederate服务器时,结果就出现了.

federated-identity single-sign-on pingfederate

7
推荐指数
1
解决办法
2262
查看次数

Ping Federate:单点登录身份验证失败

我在实现Ping Federate时遇到了这个问题

Error - Single Sign-On
Single sign-on authentication was unsuccessful (reference # TAELHKAD).
Please contact your system administrator for assistance regarding this error.
Partner: localhost:default:entityId
Target Resource: http://sp-connection.com 
Run Code Online (Sandbox Code Playgroud)

但服务器日志不显示任何错误消息/指示:

16:32:32,854 DEBUG [IntegrationControllerServlet] GET: https://localhost:9031/idp/startSSO.ping
16:32:32,856 DEBUG [IdpAdapterSupportBase] IdP Adapter Selection disabled, performing legacy adapter selection.
16:32:32,859 DEBUG [InterReqStateMgmtMapImpl] Object removeAttr(key: null, name: NUMBER_OF_ATTEMPTS): null
16:32:32,860 DEBUG [AttributeMap] Ignoring attempt to add null value to attribute map for context.TargetResource
16:32:32,860 DEBUG [AttributeMapping] Source attributes:{not-before=2014-05-26T10:47:32Z, authnContext=urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified, subject=joe, userId=joe, context.AuthenticationCtx=urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified, context.ClientIp=127.0.0.1, not-on-or-after=2014-05-26T10:52:32Z, …
Run Code Online (Sandbox Code Playgroud)

single-sign-on pingfederate

3
推荐指数
1
解决办法
7602
查看次数

带有重音字符的Java Properties文件

我正在尝试从文本文件加载一个属性,但重音字符(saül)有一个不同的编码,而不是UTF-8如何避免它?

我的属性文件有一个带有重音字符的属性(saül).然而,当我远程调试时,我发现了properties.load(bufferedReader); 把它当作saül所以当我写入另一个文件时它被写成saül,我在应用程序的其他地方都有UTF-8编码.从文件中读取属性时,我不确定我做错了什么.

try {
    final String propertyFilePath = System.getProperty(JVM_ARGUMENT_NAME);
    if (StringUtils.hasText(propertyFilePath)) {
        setLocalOverride(true);
        resource = getApplicationContext().getResource(propertyFilePath);
        BufferedReader bufferedReader =
            new BufferedReader(new InputStreamReader(new FileInputStream(propertyFilePath), "UTF8"));
        properties.load(bufferedReader);
        externalFilePasswordConfigurer.afterPasswordPropertiesSet(properties);
        LOGGER.info("ExternalFilePropertyConfigurer UTF-8 Reader");
    }
    setProperties(properties);
    logProperties(properties);
} catch (Exception e) {
    LOGGER.error("ExternalFilePropertyConfigurer setter failed to set properties: ", e);
    throw new RuntimeException(e);
}
Run Code Online (Sandbox Code Playgroud)

java spring utf-8 properties-file

3
推荐指数
1
解决办法
3126
查看次数

Wildfly / WebSocket / Apache:WebSocket已经处于CLOSING或CLOSED状态

我能够使用以下apache配置在本地计算机上成功运行websocket,

ProxyRequests off
ProxyPreserveHost on
<Location /chat>
   ProxyPass ws://localhost:8080/chat
   ProxyPassReverse ws://localhost:8080/chat
</Location>
Run Code Online (Sandbox Code Playgroud)

我正在为Apache / 2.4.7(Ubuntu)使用mod_proxy_wstunnel,并使用Wildfly 9.0.1。当我将部署转移到具有相同配置的生产服务器(AWS)时,我得到的是以下响应,

WebSocket已经处于CLOSING或CLOSED状态。

奇怪的是,我实际上能够使用wscat从托管服务器内部连接到WebSocket ,

wscat -c ws://example.com/chat/1/
Run Code Online (Sandbox Code Playgroud)

但是,来自服务器/浏览器外部的连接导致了我上面所述的响应。首先,我认为该问题可能是由于AWS过滤了Hop-by-Hop标头,即删除了websocket请求的Upgrade和Connection标头。但是,当我使用websocketd创建一个虚拟websocket服务器时,我能够通过相同的URL来获取结果。

我不确定该问题是否与Wildfly应用程序服务器或Apache Proxy Pass有关。我也尝试使用NGINX,但得到的响应与使用Apache的响应相同。一些Stackoverflow帖子建议禁用我已经完成的mod_reqtimeout

Websocket请求成功触发了Websocket的@OnOpen事件,并立即关闭而没有任何重要日志。下面对码结果行1006CLOSED_ABNORMALLY

@OnClose
public void close(Session session, CloseReason c) {
        logger.info("Closing:" + c.getCloseCode());
}
Run Code Online (Sandbox Code Playgroud)

这是来自Chrome开发工具的请求/响应日志,

General

Request URL:ws://example.com/chat/3
Request Method:GET
Status Code:101 Switching Protocols

Response Headers

Connection:Upgrade
Content-Length:0
Date:Fri, 13 May 2016 13:09:11 GMT
Origin:http://example.com
Sec-WebSocket-Accept:pPjTLv5Dz+/vyjY/SkeMihaXDd0=
Sec-WebSocket-Location:ws://example.com/chat/3
Server:WildFly/9
Upgrade:WebSocket
X-Powered-By:Undertow/1

Request Headers

Accept-Encoding:gzip, …
Run Code Online (Sandbox Code Playgroud)

java apache amazon-web-services websocket wildfly

3
推荐指数
1
解决办法
1835
查看次数

我如何解决此错误消息:错误:virtualenvwrapper在您的路径中找不到virtualenv?

我正在尝试在我的Mac上安装Python Goose(我正在运行OSX 10.9.3).安装Goose的第一步是:

mkvirtualenv --no-site-packages goose
Run Code Online (Sandbox Code Playgroud)

但是,当我运行此命令时,我收到以下错误消息:

错误:virtualenvwrapper在你的道路上找不到virtualenv

我在http://virtualenvwrapper.readthedocs.org/en/latest/install.html页面上对此进行了研究,并将以下三行添加到我的bash_profile中:

export WORKON_HOME=$HOME/.virtualenvs

export PROJECT_HOME=$HOME/Devel

source /usr/local/bin/virtualenvwrapper.sh
Run Code Online (Sandbox Code Playgroud)

编辑bash_profile后,我用以下内容重新加载了启动文件:

source ~/.bash_profile
Run Code Online (Sandbox Code Playgroud)

但是我收到以下错误消息:

回溯(最近一次调用最后一次):文件"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py",第162行,在_run_module_as_main" main "中,fname,loader,pkg_name )文件"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py",第72行,在run_globals中的_run_code exec代码文件"build/bdist.macosx-10.9-intel /在ImportError中的egg/virtualenvwrapper/hook_loader.py",第16行:没有名为stevedore virtualenvwrapper.sh的模块:运行初始化挂钩时出现问题.

如果Python无法导入模块virtualenvwrapper.hook_loader,请检查是否已为VIRTUALENVWRAPPER_PYTHON =/usr/bin/python安装了virtualenvwrapper, 并且正确设置了PATH.

在这一点上,我不知道该怎么做,如果有人对如何继续有任何想法我会很感激帮助.谢谢,乔治

virtualenv python-2.7

2
推荐指数
2
解决办法
6167
查看次数

添加Adobe Creative SDK时出现Android Studio错误

这是我的build.gradle文件.我已经按照教程.

repositories {
    mavenCentral()
    jcenter()
    mavenLocal()
    maven {
        url "${project.rootDir}/mvn-repo/release" //ADD THE CORRECT LOCATION OF THE CREATIVESDK LIBRARY FILES
    }
}

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    packagingOptions {
        exclude 'META-  INF/NOTICE.txt'
        exclude 'META-INF/LICENSE.txt'
    }

    defaultConfig {
        applicationId "com.example.test"
        minSdkVersion 11
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':libraries:collage-views')
    compile 'com.aviary.android.feather.sdk:aviary-sdk:3.6.5'
    compile 'com.adobe.creativesdk:behance:0.2.10'
    compile 'com.adobe.creativesdk:image:4.0.0'

    // …
Run Code Online (Sandbox Code Playgroud)

android maven aviary android-studio

0
推荐指数
1
解决办法
2374
查看次数