Windows Authentication?

Jan 14, 2015 at 2:53 AM
I've got everything working great and this is a great toolkit, so thanks!

My question is...the WCF service that is generated works great with Anonymous authentication. Can I enable Windows Authentication in some manner? The Config file doesn't have the typical WCF mess to update security and the client files and connectivity is very straightforward...and I don't see security options there either.

I'm connecting from a Windows 8 Store App with Enterprise Authentication enabled that is side-loaded on a system. The WCF service is IIS-hosted and again, runs great if using ANONYMOUS authentication, yet I must use WINDOWS authentication.

Any response/help is MUCH appreciated!

Thanks!
Coordinator
Feb 4, 2015 at 8:20 AM
Hi;

The main problem is that there is no config file for the WCF service (server side).
All the WCF configuration is encapsuled in the code.
If you want to deal with authentication, you have to modify the ServiceHost (see SyncServiceHost in server project) and ServiceHostFactory (see SyncServiceHostFactory)
Here is a good starting point :
[http://www.codeproject.com/Articles/149738/Basic-Authentication-on-a-WCF-REST-Service](Basic Auth on CodeProject)

good luck :)
Feb 5, 2015 at 3:34 PM
Edited Feb 5, 2015 at 3:34 PM
I ended up passing the default credentials from the Windows 8 application (with Enterprise Authentication enabled in the package manifest)...using the default scope's DefaultScopeOfflineContext...and then went into IIS and removed all but Windows Authentication and it works!
    public static async Task<CacheRefreshStatistics> SyncAsync(CancellationTokenSource token,
        Progress<SyncProgressEvent> progress)
    {
        SyncContext = new DefaultScope.DefaultScopeOfflineContext(DatabaseName, new Uri(SyncUri, UriKind.Absolute));
        SyncContext.CacheController.ControllerBehavior.SerializationFormat = SerializationFormat.ODataJSON;
        _token = token;
        SyncContext.CacheController.ControllerBehavior.Credentials = CredentialCache.DefaultCredentials;
        var result = await SyncContext.SynchronizeAsync(_token.Token, progress);
        if (result.Error != null)
            ExceptionHandler.LogException(result.Error);
        return result;
    }