java.net.ConnectException: Connection timed out: While connecting to rally through rally rest api in java - api

I am trying to connect to rally through rally rest api for fetching a user. I am facing IO Exception while connecting to the rally URL https://rally1.rallydev.com.

Here is an example of how to connect to Rally using Rally REST toolkit for Java:
String host = "https://rally1.rallydev.com";
String apiKey = "_abc123";
RallyRestApi restApi = new RallyRestApi(new URI(host),apiKey);
where _abc123 is a placeholder for a valid ApiKey.
ApiKeys and Rally authentication is general (Rally username/password) cannot be used with your company's SSO. If your organization is using SSO to connect to Rally, and if your SSO configuration allows exceptions, your username has to be added to the exceptions list. If a user account is on the SSO exceptions list it can be used to connect to Rally using Rally authentication (username/password or ApiKey).

Related

Execute RestAPI Azure DevOps Services - Authentication with username & Password no PAT

Can i Use User/Password combination to run RestAPI to Azure DevOps Services?
Short answer NO. - see explanation at marked answer
I tried to find a way to get RestAPI working without PAT or Create a Token from Current Login Info and failed
The following Code Return 401:
using System.Net;
byte[] bytes = System.Text.Encoding.ASCII.GetBytes("user:password");
string patEncoded = Convert.ToBase64String(bytes);
var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://dev.azure.com/<ORG>/_apis/wit/workitems/22289?api-version=6.0");
httpWebRequest.Headers.Add("Authorization", "Basic " + patEncoded);
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "GET";
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
Any Advice is much appreciated
I do not want to create an app and register it on the tenant .
Authenticate your web app users for REST API access, so your app doesn't continue to ask for usernames and passwords. Azure DevOps Services uses the OAuth 2.0 protocol to authorize your app for a user and generate an access token. Use this token when you call the REST APIs from your application.
For the Authentication mechanism, REST API is using the mention-aboved authentication mechanism to be authentication.
userName & password: Azure DevOps no longer supports Alternate Credentials authentication since the beginning of March 2, 2020. Here is the document.

Power Apps - OAUTH 2 Authentication with Azure Active Directory

I have an API that implements OAUTH Azure Active Directory Authentication. To achieve this, I created 2 App Registrations: Client and Backend.
I successfully implemented a Logic App able to call the API, so I am sure the authentication flow works.
Now, I need to call the same API from Power Apps, but unfortunately I got an error.
First, I create a Custom Connector
Then, I configure the Security section in this way:
Client ID: it's the ID of the Client App Registration
Client Secret: it's the secret of the Client App Registration
Login Url: login Url from Microsoft
Tenant Id: it's the Tenant Id of App Registrations
Resource URL: I don't know what to put here, I tried by using the ID of the Backend App Registration
Scope: It's not mandatory, but I tried to set the Application ID URI of the Backend App Registration concatenated to /.default.
When I try to create a Connection at the end of the wizard
I get this error
AADSTS650052: The app needs access to a service ("http://rts.powerapps.com") that your organization "a467080d-9919-4241-a48f-8b0002685a59" has not subscribed to or enabled. Contact your IT Admin to review the configuration of your service subscriptions.
My Client App Registration has the following API Permissions
UPDATE
Following #ChauncyZhou's suggestion and adding the Redirect URL generated by the Custom Connector to Client App Registration, I completed Custom Connector and Connection creation process.
When I test the API I get a 401 error:
The audience '97e**********************9c9' is invalid
Where 97e**********************9c9 is the Backend App Registration id. Did I make some mistake when I configured the Custom Connector? API works fine with Postman and Logic App.
When you call the same API from Power Apps, you don't need to add
Powerapps Runtime Service permission.Because you are calling your own api,Not calling the Common Data service api.
Because you add this permission, but your organization has not subscribed to or enabled, so it causes an error.So for your question, you just need to remove PowerApps Runtime Service permissions.

Auth0 and ADAL.NET

I am trying to get an access token from my Auth0 setup, I am using ADAL. I don't understand why it's trying to connect to the following site when I look at fiddler:
https://login.windows.net/common/discovery/instance?api-version=1.0&authorization_endpoint=https://myusername.auth0.com/oauth/oauth2/authorize
Here is my code:
var AuthCtx = new AuthenticationContext("https://MYUSERNAME.auth0.com/oauth/token");
var token = AuthCtx.AcquireTokenAsync("https://api.MYSITE.COM", new ClientCredential("clientid here", "secret here"));
Console.WriteLine(token.Result.AccessToken);
Thank you!
ADAL is a Microsoft library that is developed to connect native devices (non-browser) e.g. desktop & mobile to either Azure AD or ADFS.
You can use it for other Identity providers but it is not supported as a generic OAuth stack.
All the samples either use Azure AD or ADFS.
The endpoint above is the common endpoint for Azure AD.

Microsoft Dynamics CRM 365 “The user authentication failed!”,InvalidOperationException

I'm using the CRM SDK to talk to CRM.
My organization has Dynamics CRM 365(On-Premise) with IFD authentication. When I am trying to connect to CRM it is showing some random behavior. Sometimes I am able to connect using AD authentication,sometimes through OnlineFederation and the most weird connection was through Live ID. In case of IFD authentication it should not connect using LiveID. I am using connection string in the following format for IFD authentication:
connectionString = $"AuthType=IFD;ServiceUri={ organizationUri }/{ AuthInfo.OrganizationUniqueName };Domain={ AuthInfo.Domain };Username={ AuthInfo.Domain }\\{ AuthInfo.UserName };Password={ AuthInfo.Password };";
I am using IDataDictionary to maintain auth information in cache. Whenever my service trying to connect to CRM using cache I am getting the following error:
System.InvalidOperationException: The user authentication failed!
at Microsoft.Xrm.Sdk.Client.ServiceProxy`1.AuthenticateCore()
I am able to check key value of cache it exists but unable to create service proxy.
serviceClient.OrganizationServiceProxy.Timeout = TimeSpan.MaxValue;

Encountered errors when trying to set up the OAuth 2.0 endpoint on my dynamic CRM 2015 internet facing deployment hosted on ADFS 3.0?

I am following the guidelines described in msdn website to set up the dynamic CRM server 2015 in my local domain, everything works as expected.
But I have some problems accessing my server with OAuth 2.0 authentication. From the official document, OAuth authentication is supported by dynamic CRM.
Developers who create modern and mobile apps, including apps not
built on the .NET Framework, can access Microsoft Dynamics CRM
business data through the SOAP and OData endpoints of the organization
web service. This web service supports certain authentication
capabilities found in the OAuth 2.0 protocol.
However when I am following the link to perform the OAuth flow, I get the below error message information in AD FS event log when trying to get the access token.
Encountered error during federation passive request. Exception
details: Microsoft.IdentityServer.RequestFailedException: MSIS7065:
There are no registered protocol handlers on path /adfs/oauth2/token
to process the incoming request. at
Microsoft.IdentityServer.Web.PassiveProtocolListener.OnGetContext(WrappedHttpListenerContext
context)
I've already added the OAuth 2.0 application into my CRM server. My question is which steps do I missed to make the OAuth authentication works?
Updated [11/11/2015]:
It turn out to me that there might be some configuration errors when I used postman do the token acquisition operation. I used PowerShell and it works. Shared my command below:
$nvc = New-Object System.Collections.Specialized.NameValueCollection
$nvc.Add("client_id", "you client id")
$nvc.Add("grant_type", "authorization_code")
$nvc.Add("code", "authorization code")
$nvc.Add("redirect_uri", "your redirect uri")
$wc = new-object net.webclient
$response = $wc.UploadValues("https://your.adfs.server/adfs/oauth2/token", "POST", $nvc)
$tokens = $wc.Encoding.GetString($response);
I had the same exact error while using postman. I just forgot to use x-www-form-urlencoded. Then it worked nicely.