How to Fix 401 Authentication Error when Publishing to Self-Hosted NuGet Server - authentication

I followed these instructions to host a NuGet Server (version 2.2.2) on our Intranet. It works great as far as listing the packages and retrieving them in VS 2012. But when I create a package using the Nuget Package Explorer and try to publish it I am prompted with a Windows Security dialog prompting for credentials. No matter what credentials I enter it keeps re-prompting me for a user name and password and returns a 401 authentication error. Why is the NuGet server prompting me for Windows credentials and how can I get rid of it? It only does this for publishing and nothing else.

There are one more thing apart from permissions configuration for Packages folder. In my case I have to use URL like
http://<server>/<nuget_virtual_dir>/api/v2/package/
for pushing. It was the only solution in my case.

When you use NuGet push you need to put /api/v2/package after the NuGet server URL (example http://myhost/myNuGetServer/api/v2/package)
If you use the NuGet user interface (NuGet Package Explorer) you need to put just the server url than URL (example http://myhost/myNuGetServer/)
Take care also of apikey configuration in Web.config and use it in NuGet push!

I think a found a solution (at least to my problems):
I gave up to the Nuget problem, and I focused in the ISS 401 error. Then I gave permissions to the user "IIS AppPool\DefaultAppPool" to the app's root (or your AppPool that use the app, in my case "ASP.NET v4.0"). Then it work like charm!.
More info (and good explanation about the problem): ApplicationPoolIdentity in IIS7 401 errors

You may find this SO answer helpful, as it covers how to configure credentials on a publishing workstation (or build server, but in either case it's accurate info.)

Related

nuget push command line request was forbidden

I have a jfrog artifactory repo which is created, and I can upload nuget packages just fine using the website UI if I login with my username / password.
But If I try to push a .nupkg file from the command line using this command:
nuget push 3D9-3v.2.1.1.nupkg -Source https://artifactory-amec.ta.company.com:443/artifactory/my-artifactory-repo/
it asks me to provide credentials:
WARNING: No API Key was provided and no API Key could be found for 'https://artifactory-amec.ta.company.com:443/artifactory/my-artifactory-repo/'. To save an API
Key for a source use the 'setApiKey' command.
Pushing 3D9-3v.2.1.1.nupkg to 'https://artifactory-amec.ta.company.com:443/artifactory/my-artifactory-repo/'...
PUT https://artifactory-amec.ta.company.com:443/artifactory/my-artifactory-repo/
MSBuild auto-detection: using msbuild version '16.5.1.21502' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\bin'.
Please provide credentials for: https://artifactory-amec.ta.company.com:443/artifactory/my-artifactory-repo/
UserName:
If I enter the same username / password I use to log in online via web browser, I get a response saying the request was forbidden?
The remote server indicated that the previous request was forbidden. Please provide credentials for: https://artifactory-amec.ta.company.com:443/artifactory/my-artifactory-repo/
UserName:
If i try to use my username and the jfrog artifactory api key instead I get a slightly different error
Please provide credentials for: https://artifactory-amec.ta.company.com:443/artifactory/my-artifactory-repo/
is my username / password auth combo valid, and understood, but rejected due to some reason?Is there a setting I need to enable for pushing nuget packages to my repo via the command line? Im confused because I can drag and drop upload via web browser perfectly fine

Azure Ad b2c custompolicy starter pack local signin

I have tried to make custom policies. then I used custom policy starter pack from https://github.com/Azure-Samples/active-directory-b2c-custom-policy-starterpack.git
First I registered new user, then I tried sign In process but it doesn't work.
Error message says "The username or password provided in the request are invalid"
Do you have any solution of this?
*I registered B2C_1A_TokenSigningKeyContainer and B2C_1A_TokenEncryptionKeyContainer.
*And I replaced each keys particular place on SignUpOrSignin.xml(followed the guidance from microsoft web page )
One of the common causes of this issue is the misconfiguration of application IDs of IdentityExperienceFramework and ProxyIdentityExperienceFramework.
Check out this to make sure the configuration is correct.

Fusionauth ADFS integration issue

I'm evaluating the FusionAuth server locally on my windows machine and I'm trying to set up a identity provider to a adfs server. I have followed the steps as outlined in the docs.
After I login at the adfs I get a 405 error at the /samlv2/acs page.
I have enabled the debug flag on the provider. However no events show up in the System -> Event log page. Should I be able to see these events there?
Under logs catalogue I see a "fusionauth-search" file but no "fusionauth-app" log. Is the fusion-app log the correct place to debug this problem? What could be the reason why it is missing?
Thanks
This looks to be a bug in FusionAuth version 1.7.3.
As a workaround, modify your relying party configuration to use /oauth2/callback instead of /samlv2/acs.
This has been resolved in version 1.7.4. Thanks!
https://fusionauth.io/docs/v1/tech/release-notes/

How to pass credentials when accessing a Nuget feed

I am trying to download packages from a Nuget repository which requires credentials for it to be accessed using NuGet.Core.
I know that Nuget repositories with no authentication can be accessed as follows:
//ID of the package to be looked up
string packageID = "EntityFramework";
//Connect to the official package repository
IPackageRepository repo = PackageRepositoryFactory.Default.CreateRepository("https://packages.nuget.org/api/v2");
//Initialize the package manager
string path = <PATH_TO_WHERE_THE_PACKAGES_SHOULD_BE_INSTALLED>
PackageManager packageManager = new PackageManager(repo, path);
//Download and unzip the package
packageManager.InstallPackage(packageID, SemanticVersion.Parse("5.0.0"));
(source: Nuget blog)
Now suppose I have the credentials of a Nuget repository.
I tried to get the package using http client and network credentials but it did not work.
So how do I pass the credentials along to the Nuget server?
Also I would like to know how to restrict access to a Nuget feed(what do newer versions offer?).
I can't seem to find any clear documentation.
Thanks.
I am assuming you are using NuGet 2.x and not NuGet 3.0.
In order for NuGet to send credentials to a server you need to configure the DefaultCredentialProvider on NuGet's HttpClient class.
HttpClient.DefaultCredentialProvider = new YourCredentialProvider ();
NuGet provide a SettingsCredentialProvider class which will try to find username's and password's in the user's NuGet.Config file but you still need to implement your own ICredentialProvider since the SettingsCredentialProvider requires one to be passed to its constructor. It uses this credential provider typically to prompt the user to enter credentials.
HttpClient.DefaultCredentialProvider = new SettingsCredentialProvider(new ConsoleCredentialProvider(Console), SourceProvider, Console);
NuGet provides a ConsoleCredentialProvider which you could use. It also provides a Console and a way to create a source provider.
To restrict access to your own NuGet server you can use the NuGet.Server NuGet package and create your own web app. Then you can host that on IIS and use the standard IIS authentication features.
An alternative is to use a third party hosting service such as MyGet which allows you to setup private feeds that require authentication.

RavenDB: Windows user credentials not sufficient for write access

I'm trying to use the RavenDB server web/silverlight UI to create databases and test data, and am being asked for a username/password. This is fine, and the documentation on http://blogs.hibernatingrhinos.com/5/ravendb-in-practice-part-1-an-introduction-to-ravendb says that I should use my Windows credentials:
Be default RavenDB allow anonymous access only for read requests (HTTP GET), and since we creating data, we need to specify a username and password. You can control this by changing the AnonymousAccess setting in the server configuration file.
Enter your username and password of your Windows account and a sample data will be generated for you.
However the dialog reappears instantly. A few tries later and it fails with an authorisation error.
I'm using the Raven Silverlight client through Google Chrome Windows XP Home SP3, and haven't changed RavenDB's settings (I want it to work with authentication, rather than dodging the issue).
1) Make sure you give user permissions to read/write in the directory where raven is installed.
2) Make sure that you have set in web.config
3) Check this thread RavenDB Network Access