Replace default Authentication Service

Topics: CAB & Smart Client Software Factory
Nov 17, 2005 at 12:48 PM
originally posted by: Saramcc

I am attempting to replace the default Authentication Service with my own custom service. I've created a public class that implements IAuthenticationService and has a public Authenticate method.

I then added an app configuration file and added a 'compositeUI' section (as shown below). However, when I run the app, it still picks up the default authentication service. In fact, when I step through the code, it appears to not find the 'compositeUI' section in the app config file.

Any ideas?

<configuration>
<configSections>
<section name="compositeUI" type="Microsoft.ApplicationBlocks.CompositeUI.Configuration.SettingsSection, Microsoft.ApplicationBlocks.CompositeUI"
allowExeDefinition="MachineToLocalUser" />
</configSections>
<compositeUI>
<services>
<add serviceType="Microsoft.ApplicationBlocks.CompositeUI.Services.IAuthenticationService, Microsoft.ApplicationBlocks.CompositeUI"
instanceType="myNamespace.myAuthServiceClass, myNamespace" />
</services>
</compositeUI>
</configuration>
Nov 17, 2005 at 1:12 PM
originally posted by: BradWilsonMSFT

The name should be "CompositeUI", not "compositeUI". XML is case sensitive.
Nov 18, 2005 at 4:57 AM
originally posted by: Saramcc

Yep, I've tried that -- then I get the runtime error "Could not load file or assembly Microsoft.ApplicationBlocks.CompositeUI". So, I'll go off and try and troubleshoot that error, since I have admittedly not done that yet. But, in the mean time, if anyone knows how to fix it, please let me know.

And, by the way, the documentation shows it as lower case (compositeUI) in the config file.
Nov 18, 2005 at 5:24 AM
originally posted by: jburkholder

Change ApplicationBlocks to Practices.
Nov 18, 2005 at 5:55 AM
originally posted by: Saramcc

I figured out my runtime error -- the code showing the config file in the documentation has incorrect namespaces. The config file should read as:
<configuration>
<configSections>
<section name="CompositeUI"
type="Microsoft.Practices.CompositeUI.Configuration.SettingsSection,
Microsoft.Practices.CompositeUI"
allowExeDefinition="MachineToLocalUser" />
</configSections>
<CompositeUI>
<services>
<add serviceType="Microsoft.Practices.CompositeUI.Services.IAuthenticationService,
Microsoft.Practices.CompositeUI"
instanceType="fully-qualified-service-class-name, assembly-file-name" />
</services>
</CompositeUI>
</configuration>