﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - Crosslight - How to Use Crosslight Authentication Service to Use Custom Password Hasher?</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-Authentication-Service-to-Use-Custom-Password-Hasher/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>How to Use Crosslight Authentication Service to Use Custom Password Hasher?</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-Authentication-Service-to-Use-Custom-Password-Hasher/</link><pubDate>Fri, 13 Feb 2015 10:52:51 GMT</pubDate><dc:creator>technical@intersoftpt.com</dc:creator><description>&lt;p&gt;&lt;span style="font-size: 10pt;"&gt;Glad to hear everything works out great for you!&lt;/span&gt;&lt;/p&gt;&lt;p&gt;If you've submitted any Crosslight apps to Store, please let us know and we'd love to see it in action. :)&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;</description></item><item><title>How to Use Crosslight Authentication Service to Use Custom Password Hasher?</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-Authentication-Service-to-Use-Custom-Password-Hasher/</link><pubDate>Thu, 12 Feb 2015 06:07:31 GMT</pubDate><dc:creator>jtungol@silentpartnersoft.com</dc:creator><description>This guide works, awesome! Thanks!&lt;br&gt;</description></item><item><title>How to Use Crosslight Authentication Service to Use Custom Password Hasher?</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-Authentication-Service-to-Use-Custom-Password-Hasher/</link><pubDate>Tue, 10 Feb 2015 19:28:55 GMT</pubDate><dc:creator>jtungol@silentpartnersoft.com</dc:creator><description>We'll take a look and see how things work. Thanks!&lt;br&gt;</description></item><item><title>How to Use Crosslight Authentication Service to Use Custom Password Hasher?</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-Authentication-Service-to-Use-Custom-Password-Hasher/</link><pubDate>Sat, 07 Feb 2015 11:28:42 GMT</pubDate><dc:creator>technical@intersoftpt.com</dc:creator><description>&lt;p&gt;On top of Yudi's response, of course, you'll also need to create a custom class that derives from WebApiAccountService where you need to override the &lt;i&gt;RegisterDefaultAuthenticator&lt;/i&gt; and &lt;i&gt;GetDefaultAuthenticator&lt;/i&gt; methods, to link the default authenticator to the one you created in the step above. See the following example.&lt;/p&gt;&lt;pre&gt;&lt;br&gt;&lt;br&gt;public class MyWebApiAccountService : WebApiAccountService&lt;br&gt;{&lt;br&gt;&lt;br&gt;    protected override void RegisterDefaultAuthenticator()    {
        this.AuthenticationService.Register&amp;lt;CustomWebApiAuthenticator&amp;gt;(this.AccountServiceId);
    }
     
    protected override WebApiAuthenticator GetDefaultAuthenticator()
    {
        return this.AuthenticationService.GetAuthenticator&amp;lt;CustomWebApiAuthenticator&amp;gt;();
    }&lt;br&gt;&lt;br&gt;
}&lt;br&gt;&lt;br&gt;&lt;/pre&gt;&lt;p&gt;&lt;span style="font-size: 10pt;"&gt;Finally, remember to replace the new authenticator in the AppService.&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;           &lt;br&gt;ServiceProvider.AddService&amp;lt;IAccountService, MyWebApiAccountService&amp;gt;();

&lt;/pre&gt;&lt;p&gt;&lt;span style="font-size: 10pt;"&gt;And that's the beauty of IoC design pattern which is heavily used in Crosslight. It allows you to extend or replace most functionalities in Crosslight, just like that.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10pt;"&gt;Hope this helps.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10pt;"&gt;&lt;br&gt;&lt;/span&gt;&lt;/p&gt;</description></item><item><title>How to Use Crosslight Authentication Service to Use Custom Password Hasher?</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-Authentication-Service-to-Use-Custom-Password-Hasher/</link><pubDate>Fri, 06 Feb 2015 10:07:16 GMT</pubDate><dc:creator>yudi</dc:creator><description>&lt;p&gt;&lt;span style="color: #1f497d;"&gt;I refer to ExecuteLogin method (LoginViewModel.cs) in Crosslight Business project template. It has CreateEncryptedAccount(username, password) to create the encrypted account, to hash the password from the client side.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color: #1f497d;"&gt;You can implement your own custom password hasher by creating a class which derives BasicWebApiAuthenticator, then override CreateEncryptedAccount&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;public override IAccount CreateEncryptedAccount(string username, string password)
    {
        //return this.GetDefaultAuthenticator().CreateEncryptedAccount(username, password);
        IHashCryptographicService cryptoService = ServiceProvider.GetService&amp;lt;IHashCryptographicService&amp;gt;();
            
        // assign signature with encrypted password 
        string signature = ...;
            
        var account = new Account(username, this.AccountServiceId, new Dictionary&amp;lt;string, object&amp;gt; { { Account.PasswordHash, signature } });

        if (this.AccountServiceId != this.ServiceId)
            account.Properties[Account.AuthenticatorServiceIdentifier] = this.ServiceId;

        return account;
    }&lt;/pre&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;Hope this helps.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>How to Use Crosslight Authentication Service to Use Custom Password Hasher?</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-Authentication-Service-to-Use-Custom-Password-Hasher/</link><pubDate>Thu, 05 Feb 2015 12:53:07 GMT</pubDate><dc:creator>jtungol@silentpartnersoft.com</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;&lt;p&gt;How can we use a &lt;span style="font-weight: bold;"&gt;custom password hasher&lt;/span&gt; to hash the password from the client side using the &lt;span style="font-weight: bold;"&gt;Authentication Service&lt;/span&gt;? We do not want to re-hash all of our existing user accounts just to align with the default password hasher being used by &lt;span style="font-weight: bold;"&gt;Crosslight Framework&lt;/span&gt; or &lt;span style="font-weight: bold;"&gt;Microsoft ASP.Net Identity&lt;/span&gt; for that matter, since this is going to be a tedious task. Now, while our mobile app use &lt;span style="font-weight: bold;"&gt;Crosslight's Enterprise Framework&lt;/span&gt;, we assigned the custom password hasher (implemented from &lt;span style="font-weight: bold;"&gt;IPasswordHasher&lt;/span&gt;) to the Web API while creating an instance of the &lt;span style="font-weight: bold;"&gt;UserManager &lt;/span&gt;on the &lt;span style="font-weight: bold;"&gt;IdentityController&lt;/span&gt;. However, we believe this is incomplete, as we believe there are still work to be done on the client side to make it work with Crosslight's Authentication Service.&lt;/p&gt;</description></item></channel></rss>