我正在尝试将 WS-Security 添加到我现有的服务中,其中所述服务是通过 TLS 访问的,并且我基本上成功地使用 SoapUI 对其进行了测试。
但是我对返回的响应有疑问;尽管响应看起来很完整,SoapUI 仍报告:
ERROR:org.apache.ws.security.WSSecurityException: An invalid security token was provided (Bad TokenType "")
org.apache.ws.security.WSSecurityException: An invalid security token was provided (Bad TokenType "")
at org.apache.ws.security.str.BSPEnforcer.checkEncryptedKeyBSPCompliance(BSPEnforcer.java:113)
at org.apache.ws.security.str.SecurityTokenRefSTRParser.processPreviousResult(SecurityTokenRefSTRParser.java:313)
at org.apache.ws.security.str.SecurityTokenRefSTRParser.parseSecurityTokenReference(SecurityTokenRefSTRParser.java:101)
at org.apache.ws.security.processor.ReferenceListProcessor.decryptDataRefEmbedded(ReferenceListProcessor.java:169)
at org.apache.ws.security.processor.ReferenceListProcessor.handleReferenceList(ReferenceListProcessor.java:104)
at org.apache.ws.security.processor.ReferenceListProcessor.handleToken(ReferenceListProcessor.java:64)
at org.apache.ws.security.WSSecurityEngine.processSecurityHeader(WSSecurityEngine.java:402)
Run Code Online (Sandbox Code Playgroud)
根据我所读到的内容,这是由于回复中的 SecurityTokenReference 元素缺少 TokenType 属性,这是遵守基本安全配置文件的条件。
问题是 - 如何在 WCF 中填充此属性?我没有找到任何关于这方面的明确信息。
来自 WCF 服务的 SOAP 响应中的加密密钥部分如下所示:
<e:EncryptedKey Id="_0" xmlns:e="http://www.w3.org/2001/04/xmlenc#">
<e:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p">
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" xmlns="http://www.w3.org/2000/09/xmldsig#"/>
</e:EncryptionMethod>
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<o:SecurityTokenReference>
<o:KeyIdentifier ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509SubjectKeyIdentifier" EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">K6Ag94AG3hQuQ+rqQcBvb88Vl+Y=</o:KeyIdentifier>
</o:SecurityTokenReference>
</KeyInfo>
<e:CipherData>
<e:CipherValue>FQ58hAfisez2D8J9A49xFRQjfTSFhrWP9wJDnWq0MctAyLhoAynzu3/Z0jYK91uE4DVCgkFo9QGH6O/kR1icQxkpv/xb5gcB1mJTbIpbCOzw6ZtMEfbY0r9ML2fDcChGFPM/nh70Daqi4P9IO8dIZ5EAUcERvDMFvj4fhwwVycSNFUX40/8ywQALQksPb+1j2B3pzHntcyb6CJ0qD10xjbyyQoT0BgR/HeDQEJDQNvx41eqoDSy2/ImkNNfFCXQ47/k1sN48tWur6GEzDuwUBbiAJxVrCgzc6a7F9CrhWiE6DAublBzM8/EBKP5UD5p2WTcjDQxI4cBhqRwIGYcfhQ==</e:CipherValue>
</e:CipherData> …Run Code Online (Sandbox Code Playgroud) 亲爱的专业人士请帮助我解决以下问题.在我的.NET C#应用程序中,有一个代码:
SqlConnection connection = new SqlConnection( SQLCONNECTION_STRING );
Run Code Online (Sandbox Code Playgroud)
它在我的开发机器上运行得非常好,但在Windows 2003服务器上抛出异常.该应用程序通过CGI运行并具有"完全信任"级别.我已经尝试了几个连接字符串,我认为字符串不会导致问题,因为即使这个代码也会出现异常:
SqlConnection connection = new SqlConnection();
Run Code Online (Sandbox Code Playgroud)
谢谢.
我发现了两个奇怪的事实:
所以我猜CGI和SqlConnection交互有问题.有人知道吗?
谢谢大家的回复.
编辑添加:
这是我的连接字符串:"Provider = SQLOLEDB; Data Source =(local); Initial Catalog = Users; User Id = user; Password = password;"
我还尝试了几种可能的变体,如:http://www.connectionstrings.com/sql-server
请在下面找到有关例外情况的信息:
The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception.
at System.Data.SqlClient.SqlConnection..ctor()
at Test.Database.UpdateSQLServerDatabase(IDictionary`2 fields, String regName, StringBuilder regCode)
at Test.Program.Run()
Type: System.TypeInitializationException
InnerException: System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.SqlConnectionFactory' threw an exception. ---> System.TypeInitializationException: The type …Run Code Online (Sandbox Code Playgroud) 有人可以帮我吗,因为我无法使用 awk 命令将一些简单的 3 列 CSv 输出到 SQl
CSV
01Aug2011,user,12
02Aug2011,userb,34
Run Code Online (Sandbox Code Playgroud)
AWK
我知道这个对我有用
awk -F',' '{ print "INSERT INTO Testing (`Date`,`User`,`Usage`) VALUES (" "'"$1"'""," """'"$2"'""," """'"$3"'"")" ""}' new.csv > output.log
Run Code Online (Sandbox Code Playgroud)
但不是这个
awk -F',' '{ print "INSERT INTO Testing (`Date`,`User`,`Usage`) VALUES (" "`"$1"`""," """`"$2"`""," """`"$3"`"")" ""}' new.csv > output.log
Run Code Online (Sandbox Code Playgroud) prompt在我的个人资料中,我通过嵌入 git 分支信息的函数自定义了提示:
function prompt
{
$prefix = ""
if ((test-path ".git") -or (test-path ".gitdir") -or ((git rev-parse --is-inside-work-tree 2> $null) -eq "true")) {
$prefix = "[git:" + (& git symbolic-ref --short HEAD) + "]"
}
write-host "PS $prefix $(get-location) >" -nonewline -foregroundcolor DarkMagenta
return " "
}
Run Code Online (Sandbox Code Playgroud)
然而问题是,当我在 git 树之外时,即使我将错误重定向到 $null,git rev-parse检查的部分也会插入错误。$error
这意味着 $error 会受到以下错误的污染,因为每次提示呈现时都会生成该错误:
git : fatal: Not a git repository (or any of the parent directories): .git
At C:\temp\prompt.ps1:4 char:64
+ ... ".gitdir") …Run Code Online (Sandbox Code Playgroud) 我正在尝试调试代码中的问题.我有一个持续运行的流程A,直到我要求它停止.
在AI内部执行以下操作:
open() //创建一个空文件X.write() //给它写一些字节close() //关闭文件processFile() //执行一些操作remove() //删除文件注意我在上面的每个操作之后测试它是否成功或不是前进.当我这样做时,lsof | grep A它显示了进程A拥有的X的文件句柄.我也看到它有一个(已删除).这可以防止我卸载分区.为什么会发生这种情况?如何解决这个问题?
编辑:谢谢大家.这是代码的片段:
tarFileDesc = _pSysCall->open("test.tar", O_CREAT | O_RDWR | O_APPEND, 0777);
if (0 > tarFileDesc)
return false;
... some logging here
// Write http stream to tar file, istr is an argument to my function
int read_buffer_size = 0;
buffer = new char[4096];
while (!istr.eof() && count < content_length)
{
if ((content_length - count) >= 4096)
read_buffer_size = 4096; …Run Code Online (Sandbox Code Playgroud) 在编程时我完全没用,所以记住这一点!
我们必须编写一个生成两个随机数的代码,然后将这两个随机数传递给一个生成然后返回总和的函数.提示学生回答问题,如果他们弄错了,程序应该循环直到他们做对了,如果他们是正确的,程序应该循环并提出另一个问题.
当我编译时,我不断收到这些错误:
multi.c: In function ‘multiply’:
multi.c:6:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
multi.c:27:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
multi.c:31:1: error: expected ‘{’ at end of input
Run Code Online (Sandbox Code Playgroud)
这是我的代码,有人可以帮助我:
#include <stdio.h>
int multiply(int x, int y)
int main()
{
int multiply(int x, int y);
int x = rand()%20;
int y = rand()%20;
int i, answer;
i = multiply(x,y);
printf("what is %d multiplied by %d\n?" x, y);
scanf("%d\n", &answer);
while(answer …Run Code Online (Sandbox Code Playgroud) params.max = Math.min(params.max ? params.int('max') : 2, 100)
orders=OrderInfo.createCriteria().listDistinct()
Run Code Online (Sandbox Code Playgroud)
对于分页,我们需要将params传递给列表,例如.Post.list(params).我怎么把它传递到这里?我试过但是给出了一个错误.
我们还需要总数.但我无法设置参数
orders=OrderInfo.createCriteria().listDistinct()
Run Code Online (Sandbox Code Playgroud)
请提示正确的代码
/etc/fstab 行我想编辑:
/dev/appvg/home /home ext3 defaults 0 0
Run Code Online (Sandbox Code Playgroud)
如何让 sed 在默认列后面插入“,nodev”?
我在另一篇文章中发现了这个命令,该命令在“默认值”之前插入它,但我不知道如何在之后插入:
sed -ie 's:\(.*\)\(\s/home\s\s*\)\(\w*\s*\)\(\w*\s*\)\(.*\):\1\2\3nodev,\4\5:' /etc/fstab
Run Code Online (Sandbox Code Playgroud)
这给了我这个:
/dev/appvg/home /home ext3 nodev,defaults 0 0
Run Code Online (Sandbox Code Playgroud)
这就是我想要的样子:
/dev/appvg/home /home ext3 defaults,nodev 0 0
Run Code Online (Sandbox Code Playgroud)
是否可以?我是 sed 的新手...
c ×2
linux ×2
.net ×1
awk ×1
bash ×1
c# ×1
c++ ×1
grails ×1
pagination ×1
powershell ×1
sed ×1
shell ×1
soap ×1
soapui ×1
sql ×1
sql-server ×1
wcf ×1
ws-security ×1