我正在 Linux 机器内使用 VS 代码开发 dotnet core 项目。
按照以下博客生成覆盖率报告: https://www.hanselman.com/blog/AutomaticUnitTestingInNETCorePlusCodeCoverageInVisualStudioCode.aspx
正如那里提到的,我传递了 dotnet 测试参数,如下所示:
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=./lcov.info
Run Code Online (Sandbox Code Playgroud)
并期望生成 lcov.info 文件,但它没有。
我在这里错过了什么吗?
ps:我已经包含这个包了
<PackageReference Include="coverlet.collector" Version="1.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Run Code Online (Sandbox Code Playgroud) 我在我的 Angular 8 项目中使用 8.0.4 的发布版本,并具有授权代码流程:
这是我的代码
this.oauthService.configure(authConfig);
this.oauthService.tokenValidationHandler = new JwksValidationHandler();
this.oauthService
.loadDiscoveryDocument()
.then(() => this.oauthService.tryLogin()) ---> [1]
.then(() => {
if (this.oauthService.hasValidAccessToken()) {
return Promise.resolve();
}else{
this.oauthService.initCodeFlow() ---> [2]
}
});
}
Run Code Online (Sandbox Code Playgroud)
最初,当用户未登录时,[2] 处的代码会将用户重定向到登录页面。
一旦用户提供用户名/密码并单击登录,身份提供程序就会重定向回查询字符串中包含“代码”的应用程序,也就是说,当我期望 [1] 处的代码使用代码登录用户时(通过将其兑换为令牌)。
相反,tryLogin() 方法不起作用,并且用户再次在无限循环中重定向到授权端点。
请帮助我理解这里出了什么问题。
另外,此示例: https: //github.com/jeroenheijmans/sample-angular-oauth2-oidc-with-auth-guards/ 适用于版本 8 吗?
从最近的版本和下面的对话来看,现在 Katana(4.1.0) 支持带有自动代码兑换的代码流(这意味着我们没有显式调用 tokenendpoint 来兑换 idtoken、accesstoken 等代码)
https://github.com/aspnet/AspNetKatana/pull/297
所以,我已经升级了 Katana dll 并且有 p
Notifications = new OpenIdConnectAuthenticationNotifications()
{
RedirectToIdentityProvider = OnRedirectToIdentityProvider,
//MessageReceived = OnMessageReceived, -- previous I were calling token endpoint in this notification
SecurityTokenReceived = notification => Task.FromResult(0),
SecurityTokenValidated = OnSecurityTokenValidated,
AuthenticationFailed = OnAuthenticationFailed,
AuthorizationCodeReceived = AuthorizationCodeReceived, -- added this notification per latest improvements
TokenResponseReceived = TokenResponseReceived
}
Run Code Online (Sandbox Code Playgroud)
以及这里的实现
private Task AuthorizationCodeReceived(AuthorizationCodeReceivedNotification arg)
{
return Task.FromResult(0);
}
Run Code Online (Sandbox Code Playgroud)
我期望中间件调用令牌端点来兑换授权代码,但这不会发生。
我在这里错过了什么吗?我应该在此处添加一些代码以便中间件兑换代码吗?请各位指教..
更新:
我按照其他博客设置如下,
args.App.UseOpenIdConnectAuthentication(
new OpenIdConnectAuthenticationOptions
{
//other properties removed for …
Run Code Online (Sandbox Code Playgroud) 我通过https命中服务时看到以下错误。我尝试过如下更改Soap ui VM选项文件中的TLS版本:
-Dsoapui.https.protocols = TLSv1.0 -Dsoapui.https.protocols = TLSv1.2
也没有运气 请指教
Thu Sep 07 11:32:47 BST 2017:ERROR:javax.net.ssl.SSLException: Received fatal alert: protocol_version
javax.net.ssl.SSLException: Received fatal alert: protocol_version
at sun.security.ssl.Alerts.getSSLException(Unknown Source)
at sun.security.ssl.Alerts.getSSLException(Unknown Source)
at sun.security.ssl.SSLSocketImpl.recvAlert(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.writeRecord(Unknown Source)
at sun.security.ssl.AppOutputStream.write(Unknown Source)
at org.apache.http.impl.io.AbstractSessionOutputBuffer.flushBuffer(AbstractSessionOutputBuffer.java:131)
at org.apache.http.impl.io.AbstractSessionOutputBuffer.flush(AbstractSessionOutputBuffer.java:138)
at org.apache.http.impl.conn.LoggingSessionOutputBuffer.flush(LoggingSessionOutputBuffer.java:95)
at org.apache.http.impl.AbstractHttpClientConnection.doFlush(AbstractHttpClientConnection.java:270)
at org.apache.http.impl.AbstractHttpClientConnection.flush(AbstractHttpClientConnection.java:275)
at org.apache.http.impl.conn.AbstractClientConnAdapter.flush(AbstractClientConnAdapter.java:197)
at org.apache.http.protocol.HttpRequestExecutor.doSendRequest(HttpRequestExecutor.java:258)
at com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport$SoapUIHttpRequestExecutor.doSendRequest(HttpClientSupport.java:119)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:123)
at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:633)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:454)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
at com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport$Helper.execute(HttpClientSupport.java:233)
at com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport.execute(HttpClientSupport.java:323)
at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.submitRequest(HttpClientRequestTransport.java:297)
at …
Run Code Online (Sandbox Code Playgroud) 我不太了解在高度安全的SSL连接建立中证书固定的必要性(以避免中间人攻击).
SSL证书固定需要在主机中嵌入原始服务器证书以验证服务器提供的证书.嵌入在主机中的服务器证书与由客户端验证的服务器证书之间的区别是什么?
我在这里失踪的是什么?
我的 csproj 文件中有一个构建后目标,如下所示。
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="dotnet publish '..\..\src\httpapi\httpapi.csproj' -o $(OutputPath)\service"/>
</Target>
Run Code Online (Sandbox Code Playgroud)
在我的本地计算机上运行没有任何问题,但在 sonarqube 服务器上构建时失败并出现以下错误。
MSBUILD : error MSB1009: Project file does not exist.
- Switch: '..\..\src\httpapi\httpapi.csproj'
Run Code Online (Sandbox Code Playgroud)
知道为什么会发生这种情况吗?有没有其他方法可以在我的构建后目标中提及目标项目的路径?
我尝试使用属性传输步骤设置请求标头,但无论如何无法使用JsonPath
.
要使用jsonPath访问请求标头,请在突出显示的部分中写入内容
请帮忙...
来源中的响应结构:
{
"payload": {
"content": {
"reason": "token successfully created",
"success": "true",
"authDetails": {
"accessToken": "MyaccesToken",
"expiresIn": "My ExpiryTime",
"refreshToken": "MyRefreshToken"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
目标字段中的请求结构
GET https://Myendpoint/myresouce/etc HTTP/1.1
Header1: myHeader1Value
Header2: **<Im trying to assign "MyaccessToken" in above step to this header>**
Run Code Online (Sandbox Code Playgroud)