You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by "David J. Godbey (HQ-LM020)[DIGITAL MANAGEMENT INC.]" <da...@nasa.gov.INVALID> on 2018/12/04 14:03:58 UTC

Authenticate in Microsoft Cloud, O365

Folks:
I did a quick search of the site, but I see no discussion of this. Let me ask here, does httpclient know how to authenticate to the Microsoft Cloud?
Thanks!

Dave Godbey
Email: david.j.godbey@nasa.gov<ma...@nasa.gov>
Phone: 410 569-5546


Re: Authenticate in Microsoft Cloud, O365

Posted by Gary Gregory <ga...@gmail.com>.
On Tue, Dec 4, 2018 at 10:02 AM Oleg Kalnichevski <ol...@apache.org> wrote:

> On Tue, 2018-12-04 at 16:20 +0000, David J. Godbey (HQ-LM020)[DIGITAL
> MANAGEMENT INC.] wrote:
> > Oleg,
> > NASA is moving out of the email hosting business, and they are moving
> > the email enterprise into the Microsoft cloud hosted (O365 they call
> > it) environment.
> >
>
> Please produce a complete context / wire log of the session. Please be
> sure to redact any details you deem sensitive. I do not want to be
> accused of hacking NASA, rigging elections or stealing Christmas.
>

LOL!

Gary


>
> http://hc.apache.org/httpcomponents-client-4.5.x/logging.html
>
> Oleg
>
> > One of the engineers is telling me: "on-premises is very forgiving
> > and will allow you to use domain\username.  When you go to the cloud,
> > we can only use the UPN username@domain.com."
> >
> > Currently I setup my client authenticator as follows, where "on-
> > premises" works fine, but cloud does not:
> >       String localIp = Inet4Address.getLocalHost().getHostAddress();
> >       CloseableHttpClient httpclient = null;
> >       HttpHost httpHost = new HttpHost(_host, 443, "https");
> >       NTCredentials ntCredentials = new NTCredentials(_user,
> > _password, localIp, _domain);
> >       AuthScope authScope = new AuthScope(httpHost);
> >       CredentialsProvider credsProvider = new
> > BasicCredentialsProvider();
> >       credsProvider.setCredentials(authScope, ntCredentials);
> >       httpclient =
> > HttpClients.custom().setDefaultCredentialsProvider(credsProvider).bui
> > ld();
> >
> >       _httpclient = httpclient;
> >       _httpHost = httpHost;
> >
> > The working document:
> >
> https://docs.microsoft.com/en-us/exchange/client-developer/exchange-server-development
> >
> > I'll continue looking around. Do you have any advice in the interim?
> > Thanks,
> > Dave
> >
> > -----Original Message-----
> > From: Oleg Kalnichevski [mailto:olegk@apache.org]
> > Sent: Tuesday, December 04, 2018 10:41 AM
> > To: HttpClient User Discussion
> > Subject: Re: Authenticate in Microsoft Cloud, O365
> >
> > On Tue, 2018-12-04 at 14:03 +0000, David J. Godbey (HQ-LM020)[DIGITAL
> > MANAGEMENT INC.] wrote:
> > > Folks:
> > > I did a quick search of the site, but I see no discussion of this.
> > > Let me ask here, does httpclient know how to authenticate to the
> > > Microsoft Cloud?
> > > Thanks!
> > >
> > > Dave Godbey
> > > Email: david.j.godbey@nasa.gov<ma...@nasa.gov>
> > > Phone: 410 569-5546
> > >
> >
> > What is Microsoft? I vaguely remember a US company that used to
> > produce decent Linux appliances called X-Box.
> >
> > What is Microsoft Cloud exactly? What authentication schemes does it
> > support?
> >
> > Oleg
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

RE: Authenticate in Microsoft Cloud, O365

Posted by "David J. Godbey (HQ-LM020)[DIGITAL MANAGEMENT INC.]" <da...@nasa.gov.INVALID>.
Oleg,
Ok, I think I solved it. This line:
      NTCredentials ntCredentials = new NTCredentials(_user, _password, localIp, _domain);

Changed to
      NTCredentials ntCredentials = new NTCredentials(_mailbox, _password, localIp, "");

Seemed to do the trick! Thanks for your attention.


-----Original Message-----
From: Oleg Kalnichevski [mailto:olegk@apache.org] 
Sent: Tuesday, December 04, 2018 12:02 PM
To: HttpClient User Discussion
Subject: Re: Authenticate in Microsoft Cloud, O365

On Tue, 2018-12-04 at 16:20 +0000, David J. Godbey (HQ-LM020)[DIGITAL MANAGEMENT INC.] wrote:
> Oleg,
> NASA is moving out of the email hosting business, and they are moving 
> the email enterprise into the Microsoft cloud hosted (O365 they call
> it) environment. 
> 

Please produce a complete context / wire log of the session. Please be sure to redact any details you deem sensitive. I do not want to be accused of hacking NASA, rigging elections or stealing Christmas.

http://hc.apache.org/httpcomponents-client-4.5.x/logging.html

Oleg  

> One of the engineers is telling me: "on-premises is very forgiving and 
> will allow you to use domain\username.  When you go to the cloud, we 
> can only use the UPN username@domain.com."
> 
> Currently I setup my client authenticator as follows, where "on- 
> premises" works fine, but cloud does not:
>       String localIp = Inet4Address.getLocalHost().getHostAddress();
>       CloseableHttpClient httpclient = null;
>       HttpHost httpHost = new HttpHost(_host, 443, "https");
>       NTCredentials ntCredentials = new NTCredentials(_user, 
> _password, localIp, _domain);
>       AuthScope authScope = new AuthScope(httpHost);
>       CredentialsProvider credsProvider = new 
> BasicCredentialsProvider();
>       credsProvider.setCredentials(authScope, ntCredentials);
>       httpclient =
> HttpClients.custom().setDefaultCredentialsProvider(credsProvider).bui
> ld();
> 
>       _httpclient = httpclient;
>       _httpHost = httpHost;
> 
> The working document: 
> https://docs.microsoft.com/en-us/exchange/client-developer/exchange-se
> rver-development
> 
> I'll continue looking around. Do you have any advice in the interim?
> Thanks,
> Dave
> 
> -----Original Message-----
> From: Oleg Kalnichevski [mailto:olegk@apache.org]
> Sent: Tuesday, December 04, 2018 10:41 AM
> To: HttpClient User Discussion
> Subject: Re: Authenticate in Microsoft Cloud, O365
> 
> On Tue, 2018-12-04 at 14:03 +0000, David J. Godbey (HQ-LM020)[DIGITAL 
> MANAGEMENT INC.] wrote:
> > Folks:
> > I did a quick search of the site, but I see no discussion of this.
> > Let me ask here, does httpclient know how to authenticate to the 
> > Microsoft Cloud?
> > Thanks!
> > 
> > Dave Godbey
> > Email: david.j.godbey@nasa.gov<ma...@nasa.gov>
> > Phone: 410 569-5546
> > 
> 
> What is Microsoft? I vaguely remember a US company that used to 
> produce decent Linux appliances called X-Box.
> 
> What is Microsoft Cloud exactly? What authentication schemes does it
> support?   
> 
> Oleg
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: Authenticate in Microsoft Cloud, O365

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2018-12-04 at 16:20 +0000, David J. Godbey (HQ-LM020)[DIGITAL
MANAGEMENT INC.] wrote:
> Oleg,
> NASA is moving out of the email hosting business, and they are moving
> the email enterprise into the Microsoft cloud hosted (O365 they call
> it) environment. 
> 

Please produce a complete context / wire log of the session. Please be
sure to redact any details you deem sensitive. I do not want to be
accused of hacking NASA, rigging elections or stealing Christmas.

http://hc.apache.org/httpcomponents-client-4.5.x/logging.html

Oleg  

> One of the engineers is telling me: "on-premises is very forgiving
> and will allow you to use domain\username.  When you go to the cloud,
> we can only use the UPN username@domain.com."
> 
> Currently I setup my client authenticator as follows, where "on-
> premises" works fine, but cloud does not:
>       String localIp = Inet4Address.getLocalHost().getHostAddress();
>       CloseableHttpClient httpclient = null;
>       HttpHost httpHost = new HttpHost(_host, 443, "https");
>       NTCredentials ntCredentials = new NTCredentials(_user,
> _password, localIp, _domain);
>       AuthScope authScope = new AuthScope(httpHost);
>       CredentialsProvider credsProvider = new
> BasicCredentialsProvider();
>       credsProvider.setCredentials(authScope, ntCredentials);
>       httpclient =
> HttpClients.custom().setDefaultCredentialsProvider(credsProvider).bui
> ld();
> 
>       _httpclient = httpclient;
>       _httpHost = httpHost;
> 
> The working document: 
> https://docs.microsoft.com/en-us/exchange/client-developer/exchange-server-development
> 
> I'll continue looking around. Do you have any advice in the interim?
> Thanks,
> Dave
> 
> -----Original Message-----
> From: Oleg Kalnichevski [mailto:olegk@apache.org] 
> Sent: Tuesday, December 04, 2018 10:41 AM
> To: HttpClient User Discussion
> Subject: Re: Authenticate in Microsoft Cloud, O365
> 
> On Tue, 2018-12-04 at 14:03 +0000, David J. Godbey (HQ-LM020)[DIGITAL 
> MANAGEMENT INC.] wrote:
> > Folks:
> > I did a quick search of the site, but I see no discussion of this.
> > Let me ask here, does httpclient know how to authenticate to the 
> > Microsoft Cloud?
> > Thanks!
> > 
> > Dave Godbey
> > Email: david.j.godbey@nasa.gov<ma...@nasa.gov>
> > Phone: 410 569-5546
> > 
> 
> What is Microsoft? I vaguely remember a US company that used to
> produce decent Linux appliances called X-Box.
> 
> What is Microsoft Cloud exactly? What authentication schemes does it
> support?   
> 
> Oleg
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


RE: Authenticate in Microsoft Cloud, O365

Posted by "David J. Godbey (HQ-LM020)[DIGITAL MANAGEMENT INC.]" <da...@nasa.gov.INVALID>.
Oleg,
NASA is moving out of the email hosting business, and they are moving the email enterprise into the Microsoft cloud hosted (O365 they call it) environment. 

One of the engineers is telling me: "on-premises is very forgiving and will allow you to use domain\username.  When you go to the cloud, we can only use the UPN username@domain.com."

Currently I setup my client authenticator as follows, where "on-premises" works fine, but cloud does not:
      String localIp = Inet4Address.getLocalHost().getHostAddress();
      CloseableHttpClient httpclient = null;
      HttpHost httpHost = new HttpHost(_host, 443, "https");
      NTCredentials ntCredentials = new NTCredentials(_user, _password, localIp, _domain);
      AuthScope authScope = new AuthScope(httpHost);
      CredentialsProvider credsProvider = new BasicCredentialsProvider();
      credsProvider.setCredentials(authScope, ntCredentials);
      httpclient = HttpClients.custom().setDefaultCredentialsProvider(credsProvider).build();

      _httpclient = httpclient;
      _httpHost = httpHost;

The working document: https://docs.microsoft.com/en-us/exchange/client-developer/exchange-server-development

I'll continue looking around. Do you have any advice in the interim?
Thanks,
Dave

-----Original Message-----
From: Oleg Kalnichevski [mailto:olegk@apache.org] 
Sent: Tuesday, December 04, 2018 10:41 AM
To: HttpClient User Discussion
Subject: Re: Authenticate in Microsoft Cloud, O365

On Tue, 2018-12-04 at 14:03 +0000, David J. Godbey (HQ-LM020)[DIGITAL MANAGEMENT INC.] wrote:
> Folks:
> I did a quick search of the site, but I see no discussion of this.
> Let me ask here, does httpclient know how to authenticate to the 
> Microsoft Cloud?
> Thanks!
> 
> Dave Godbey
> Email: david.j.godbey@nasa.gov<ma...@nasa.gov>
> Phone: 410 569-5546
> 

What is Microsoft? I vaguely remember a US company that used to produce decent Linux appliances called X-Box.

What is Microsoft Cloud exactly? What authentication schemes does it
support?   

Oleg


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: Authenticate in Microsoft Cloud, O365

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2018-12-04 at 14:03 +0000, David J. Godbey (HQ-LM020)[DIGITAL
MANAGEMENT INC.] wrote:
> Folks:
> I did a quick search of the site, but I see no discussion of this.
> Let me ask here, does httpclient know how to authenticate to the
> Microsoft Cloud?
> Thanks!
> 
> Dave Godbey
> Email: david.j.godbey@nasa.gov<ma...@nasa.gov>
> Phone: 410 569-5546
> 

What is Microsoft? I vaguely remember a US company that used to produce
decent Linux appliances called X-Box.

What is Microsoft Cloud exactly? What authentication schemes does it
support?   

Oleg


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org