Login using windows authentication
-
- Posts: 92
- Joined: Tue Feb 04, 2014 3:34 pm
Login using windows authentication
The following login using a user defined in Select works.
NetworkCredential creds = new NetworkCredential("testuser1", "Passw0rd", "[SERVER]");
using (SelectServer sps = new SelectServer("http://10.214.160.13:8080", creds))
{
sps.EnsureAuthenticated();
}
What format is used to login using a domain user. Eg. fnfglobal\LR0350?
NetworkCredential creds = new NetworkCredential("LR0350", "password1", "fnfglobal");
using (SelectServer sps = new SelectServer("http://10.214.160.13:8080", creds))
{
sps.EnsureAuthenticated();
}
I get a security error so not sure what to use.
Thanks,
Peter
NetworkCredential creds = new NetworkCredential("testuser1", "Passw0rd", "[SERVER]");
using (SelectServer sps = new SelectServer("http://10.214.160.13:8080", creds))
{
sps.EnsureAuthenticated();
}
What format is used to login using a domain user. Eg. fnfglobal\LR0350?
NetworkCredential creds = new NetworkCredential("LR0350", "password1", "fnfglobal");
using (SelectServer sps = new SelectServer("http://10.214.160.13:8080", creds))
{
sps.EnsureAuthenticated();
}
I get a security error so not sure what to use.
Thanks,
Peter
-
- Posts: 92
- Joined: Tue Feb 04, 2014 3:34 pm
Re: Login using windows authentication
We recently had an upgrade in the environment while I was on vacation so mismatching DLL's may be the issue.
I will verify when I get the latest ones.
I will verify when I get the latest ones.
-
- Posts: 92
- Joined: Tue Feb 04, 2014 3:34 pm
Re: Login using windows authentication
I'm getting the following error after upgrading the DLLs in my test client. Any ideas?
QTAgent.exe Warning: 0 : An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.
Fault Code: http://www.w3.org/2003/05/soap-envelopeSender -> http://docs.oasis-open.org/wss/2004/01/ ... idSecurity
Reason: The message could not be processed because the action 'http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT' is invalid or unrecognized.
Message: The message could not be processed because the action 'http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT' is invalid or unrecognized.
QTAgent.exe Information: 0 : Failed to authenticate the current user. An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.
QTAgent.exe Warning: 0 : An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.
Fault Code: http://www.w3.org/2003/05/soap-envelopeSender -> http://docs.oasis-open.org/wss/2004/01/ ... idSecurity
Reason: The message could not be processed because the action 'http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT' is invalid or unrecognized.
Message: The message could not be processed because the action 'http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT' is invalid or unrecognized.
QTAgent.exe Information: 0 : Failed to authenticate the current user. An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.
QTAgent.exe Error: 0 : Failed to logout of server. Security error.
at SoftPro.ClientModel.Server.EnsureAuthenticated()
at SoftPro.ClientModel.Server.GetService(Type serviceType, Boolean ensureAuthenticated)
at SoftPro.ClientModel.Server.GetService(Type serviceType)
at SoftPro.Select.Client.SelectServer.GetService(Type serviceType)
at SoftPro.Select.Client.SelectServer.GetService[T]()
at SoftPro.Select.Client.SelectServer.Dispose()
QTAgent.exe Warning: 0 : An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.
Fault Code: http://www.w3.org/2003/05/soap-envelopeSender -> http://docs.oasis-open.org/wss/2004/01/ ... idSecurity
Reason: The message could not be processed because the action 'http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT' is invalid or unrecognized.
Message: The message could not be processed because the action 'http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT' is invalid or unrecognized.
QTAgent.exe Information: 0 : Failed to authenticate the current user. An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.
QTAgent.exe Warning: 0 : An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.
Fault Code: http://www.w3.org/2003/05/soap-envelopeSender -> http://docs.oasis-open.org/wss/2004/01/ ... idSecurity
Reason: The message could not be processed because the action 'http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT' is invalid or unrecognized.
Message: The message could not be processed because the action 'http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT' is invalid or unrecognized.
QTAgent.exe Information: 0 : Failed to authenticate the current user. An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.
QTAgent.exe Error: 0 : Failed to logout of server. Security error.
at SoftPro.ClientModel.Server.EnsureAuthenticated()
at SoftPro.ClientModel.Server.GetService(Type serviceType, Boolean ensureAuthenticated)
at SoftPro.ClientModel.Server.GetService(Type serviceType)
at SoftPro.Select.Client.SelectServer.GetService(Type serviceType)
at SoftPro.Select.Client.SelectServer.GetService[T]()
at SoftPro.Select.Client.SelectServer.Dispose()
-
- Posts: 1377
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Login using windows authentication
Make sure that your the username is in SPAdmin and has a default profile.
As an aside, it is sometimes easier to interpret validation errors by using:
Instead of:
As an aside, it is sometimes easier to interpret validation errors by using:
Code: Select all
string reason;
bool success = sps.TryAuthenticate(out reason);
Code: Select all
sps.EnsureAuthenticated();
Bob Richards, Senior Software Developer, SoftPro
-
- Posts: 92
- Joined: Tue Feb 04, 2014 3:34 pm
Re: Login using windows authentication
I can login with the UI using the same user that I'm trying to login using the API. I don't have SPAdmin access but will get somebody to double check.
I will change the code to use your suggestion.
Thanks,
Peter
I will change the code to use your suggestion.
Thanks,
Peter
-
- Posts: 92
- Joined: Tue Feb 04, 2014 3:34 pm
Re: Login using windows authentication
I'm getting the same error as described in the following post but their solution didn't help. I tried setting establishSecurityContext=true and that didn't work either. Should I be using a different binding?
http://stack247.wordpress.com/2013/05/2 ... her-party/
The inner FaultException goes something like: System.ServiceModel.FaultException: The message could not be processed because the action ‘http://docs.oasis-open.org/ws-sx/ws-tru ... /SCT’ is invalid or unrecognized.
It’s caused by WCF service configured to not communicate in WS-SecureConversation while the client is. Or vice versa. In my case, the client is an ASP.NET MVC 4 application that is trying to pass token (identity delegation) over to a WCF 4.5 service through WSTrustChannelFactory protocol.
Both of the client and the service must be configured to use same security context. If you want to turn WS-SecureConversation off, turn off on both config. Same applies to turning on WS-SecureConversation.
<ws2007FederationHttpBinding>
<binding>
<security mode="TransportWithMessageCredential">
<message establishSecurityContext="false" />
</security>
</binding>
</ws2007FederationHttpBinding>
http://stack247.wordpress.com/2013/05/2 ... her-party/
The inner FaultException goes something like: System.ServiceModel.FaultException: The message could not be processed because the action ‘http://docs.oasis-open.org/ws-sx/ws-tru ... /SCT’ is invalid or unrecognized.
It’s caused by WCF service configured to not communicate in WS-SecureConversation while the client is. Or vice versa. In my case, the client is an ASP.NET MVC 4 application that is trying to pass token (identity delegation) over to a WCF 4.5 service through WSTrustChannelFactory protocol.
Both of the client and the service must be configured to use same security context. If you want to turn WS-SecureConversation off, turn off on both config. Same applies to turning on WS-SecureConversation.
<ws2007FederationHttpBinding>
<binding>
<security mode="TransportWithMessageCredential">
<message establishSecurityContext="false" />
</security>
</binding>
</ws2007FederationHttpBinding>
-
- Posts: 92
- Joined: Tue Feb 04, 2014 3:34 pm
Re: Login using windows authentication
It turns out it was a DLL issue. I had copied the DLL’s to the wrong location and they would get overwritten with old DLL’s at runtime.
Thanks for your help!
Thanks for your help!
-
- Posts: 1377
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Login using windows authentication
Thanks for sharing your answer.
Bob Richards, Senior Software Developer, SoftPro