Comments (16)
@lukastosic That does make some amount of sense... one of the things the Pivotal library does is handle authentication with Eureka, so it probably shouldn't be surprising that there could be a problem using it and setting username/password.
I've logged a bug to investigate further and see if we could do something other than declare it a known issue, but I don't know when we'll look at it. In the meantime, if anybody does have a need to use both the Pivotal library and the username/password authentication please let us know with a thumbs up or a comment
https://www.pivotaltracker.com/story/show/158848832
from discovery.
We have created an issue in Pivotal Tracker to manage this:
https://www.pivotaltracker.com/story/show/149630055
The labels on this github issue will be updated when the story is started.
from discovery.
any news about this?
from discovery.
For me it seems that the only solution is to not have defaultZone. but just the url. Also the problem is that there are no translation bindings that are the setup. In Spring, its possible to translate properties (i.e. ${vcap:something:something:user}:${something:password}:${serviceurl}/eureka
from discovery.
Hi kkho,
Currently the Eureka client does not support Basic Auth (username/password) settings in the serviceUrl.
Likewise, Eureka configuration does not support the Spring Property Place holder feature (e.g. ${blah.blah}
.
I have had a couple requests to get both of these things added, so I'll look at doing that in the very near future.
I'll leave issue open to track the work
from discovery.
any progress on this.
from discovery.
I have a proposed fix for this issue. Let me know if you require any changes.
Thanks.
from discovery.
Thanks @nbarboutis, this feature is available as of 2.1.0-dev-191
!
from discovery.
I'm not sure this is included in latest "dev" release ...
When I try to run "FortuneTellerService" sample (from SteeltoeOSS samples repository) with username password I am getting "unauthorized" response
Then I did the following:
- cloned this git repo
- switched to dev branch,
- open solution in Visual Studio
- added existing project to solution (FortuneTellerService)
- removed nuget reference
- added project reference to this project (Steeltoe.Discovery.ClientCore)
Rebuild, run -> then it was OK.
I used TCPMon to scan requests, and when I used latest dev nuget, there were no Authorization header in request, but when I switched to use "project dependency" then authorization request was there.
from discovery.
@lukastosic we don't normally keep the samples in lock-step with dev feed releases. You should be able to just update the Pivotal.Discovery.ClientCore reference from 2.1.0-dev-00172
to 2.1.0-dev-194
to use this feature
from discovery.
@TimHess yeah .. that is what I did the first time I saw this thread - changed reference in sample to "latest" dev version ..
tried with 2.1.0-dev-194
, but got error that version doesn't exist .. it offered:
c:\Users\lstosic\Source\Repos\Fortune-Teller-Service>dotnet run -f netcoreapp2.1
c:\Users\lstosic\Source\Repos\Fortune-Teller-Service\Fortune-Teller-Service.csproj : error NU1102: Unable to find package Pivotal.Discovery.ClientCore with version (>= 2.1.0-dev-194)
c:\Users\lstosic\Source\Repos\Fortune-Teller-Service\Fortune-Teller-Service.csproj : error NU1102: - Found 66 version(s) in SteeltoeDev [ Nearest version: 2.1.0-dev-00194 ]
c:\Users\lstosic\Source\Repos\Fortune-Teller-Service\Fortune-Teller-Service.csproj : error NU1102: - Found 5 version(s) in SteeltoeMaster [ Nearest version: 2.0.0-master-00130 ]
c:\Users\lstosic\Source\Repos\Fortune-Teller-Service\Fortune-Teller-Service.csproj : error NU1102: - Found 3 version(s) in nuget.org [ Nearest version: 2.0.1 ]
c:\Users\lstosic\Source\Repos\Fortune-Teller-Service\Fortune-Teller-Service.csproj : error NU1102: - Found 0 version(s) in Microsoft Visual Studio Offline Packages
The build failed. Please fix the build errors and run again.
so, then changed to 2.1.0-dev-00194
(two zeros in front of the number)
I sterted TCPmon (made proxy to catch request) and got this as a request:
POST /eureka/apps/FORTUNESERVICE HTTP/1.1
Accept: application/json
Content-Type: application/json; charset=utf-8
Content-Length: 1063
Host: 10.4.1.224:5555
{"instance":{"instanceId":"LT07-
.... OTHER POST data about instance ...
}
But when I build with that local "project dependency" (instead of nuget) .. I see this in TCPmon:
POST /eureka/apps/FORTUNESERVICE HTTP/1.1
Authorization: Basic YWRtaW46RERyV21lbGp6ZTBhY3BhZXFOc3A=
Accept: application/json
Content-Type: application/json; charset=utf-8
Content-Length: 1063
Host: 10.4.1.224:5555
{"instance":{"instanceId":"LT07-Luka.infodation.local:fortuneService:5000"
... OTHER POST data
}
"non-nuget" generates proper Authorization
header
=========================
This is .csproj
(when I use nuget package)
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>netcoreapp2.1;net461</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<None Update="testcert.pfx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="2.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Https" Version="2.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.1.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.1.0" />
<PackageReference Include="Pivotal.Discovery.ClientCore" Version="2.1.0-dev-00194" />
<PackageReference Include="Steeltoe.Extensions.Configuration.CloudFoundryCore" Version="2.1.0-dev-00227" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="2.1.0" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
</ItemGroup>
</Project>
This is nuget.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="SteeltoeMaster" value="https://www.myget.org/F/steeltoemaster/api/v3/index.json" />
<add key="SteeltoeDev" value="https://www.myget.org/F/steeltoedev/api/v3/index.json" />
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
from discovery.
after trying out different things:
- Git clone samples repository (completely new "clean")
- Don't run anything ;)
- Open
Fortune-Teller-Service.csproj
file and adjutPivotal.Discovery.ClientCore
version to:2.1.0-dev-00194
- Run app
dotnet run -f netcoreapp2.1
This one does not send authentication header
Then I changed Pivotal.Discovery.ClientCore -> Steeltoe.Discovery.ClientCore with version 2.1.0-dev-00192
(Of course because of that also adjust Startup.cs
import rename "Pivotal" -> "Steeltoe")
This one DOES send out authentication header
from discovery.
Thanks Tim ... using "just" Steeltoe instead of "Pivotal" libraries is perfectly fine for my case since we will host application in our own environment, so we will not use any Pivotal Cloud services (Cloud foundry) either way ...
from discovery.
I can look into this. I already download the sample and verified the issue Luka is having.
Are the Pivotal libraries open source so I can download them and debug what's going on?
Update: Never mind I found the source.
from discovery.
@nbarboutis thanks!
For anybody following along, the source for Pivotal.Discovery is over here: https://github.com/pivotal-cf/spring-cloud-dotnet-discovery
from discovery.
I determined what is causing the issue:
The PivotalEurekaHttpClient class, although inheriting from EurekaHttpClient is overriding GetRequestMessage. The GetRequestMessage method in EurekaHttpClient class is where the serviceUrl is parsed for username and password and the appropriate header is added. By overriding this method PivotalEurekaHttpClient is bypassing this step and therefore not adding the appropriate header.
I will attempt to fix the issue soon. Will keep you posted.
from discovery.
Related Issues (20)
- Service Registry URL not resolved in PCF Marketplace Service HOT 3
- What is the difference Pivotal.Discovery.ClientCore and Steeltoe.Discovery.ClientCore? HOT 3
- Eureka Cluster config is not working in the Steeltoe Discovery HOT 2
- Is it possible to override the steeltoe configuration(without appsetting.json)? HOT 2
- Error message in Eureka server dashboard HOT 3
- Does eureka:client:serviceUrl support multiple eureka servers in the config? HOT 3
- Proxy settings are unused HOT 5
- Suport simpleinjector IOC HOT 7
- how to register to multiple eureka server HOT 3
- Cannot evict service from eureka. HOT 4
- How to bind multiple Eureka addresses HOT 5
- Can we set the instanceId to the current IP address and port. HOT 4
- Registering with Eureka discovery server working, but renew failing. HOT 10
- Failing to fetch registry HOT 10
- How to generate random instance id? HOT 4
- AddDiscoveryClient Should also add DiscoveryHttpMessageHandler HOT 1
- Implement Spring Cloud Consul using PR #50 HOT 2
- Refactor the Discovery Health check from PR #44 HOT 2
- DoGetApplicationsAsync Failed HOT 2
- Host Name and IP Address not computing on Mac and Docker HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from discovery.