Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Not sure how the code above would integrate with ServiceStack. Slightly biased but I would let ServiceStack handle this using <code>GoogleOpenIdOAuthProvider</code>. Also, the <a href="https://github.com/ServiceStack/SocialBootstrapApi" rel="nofollow">SocialBootstrapApi</a> project should make a good reference. </p> <p>The setup/configureation below gives you the url <code>'{servicestack path}/auth/googleopenid</code> which would handle the authentication. </p> <p>Assuming you have ServiceStack installed... </p> <p><strong>Nuget Install (or just referenece the ServiceStack.Authention.OpenId.dll)</strong> If you do the Nuget Install it should modify your Web.Config with most of the configuration below (think you don't get appSettings configuration)</p> <p><strong>In AppHost add AuthFeature Plugin with GoogleOpenIdOAuthProvider</strong> </p> <pre><code>public override void Configure(Funq.Container container) { Plugins.Add(new AuthFeature(() =&gt; new AuthUserSession(), new IAuthProvider[] { new GoogleOpenIdOAuthProvider(new AppSettings())})); } </code></pre> <p><strong>Add some specific urls for GoogleOpenIdOAuthProvider</strong></p> <pre><code>&lt;appSettings&gt; &lt;add key="oauth.GoogleOpenId.RedirectUrl" value="http://localhost" /&gt; &lt;add key="oauth.GoogleOpenId.CallbackUrl" value="http://localhost/api/auth/GoogleOpenId" /&gt; &lt;/appSettings&gt; </code></pre> <p><strong>Bunch of configuration within Web.config. Should be added with NuGet install of ServiceStack.Authentication.OpenId</strong></p> <pre><code>&lt;configsections&gt; &lt;sectionGroup name="dotNetOpenAuth" type="DotNetOpenAuth.Configuration.DotNetOpenAuthSection, DotNetOpenAuth"&gt; &lt;section name="openid" type="DotNetOpenAuth.Configuration.OpenIdElement, DotNetOpenAuth" requirePermission="false" allowLocation="true" /&gt; &lt;section name="oauth" type="DotNetOpenAuth.Configuration.OAuthElement, DotNetOpenAuth" requirePermission="false" allowLocation="true" /&gt; &lt;section name="messaging" type="DotNetOpenAuth.Configuration.MessagingElement, DotNetOpenAuth" requirePermission="false" allowLocation="true" /&gt; &lt;section name="reporting" type="DotNetOpenAuth.Configuration.ReportingElement, DotNetOpenAuth" requirePermission="false" allowLocation="true" /&gt; &lt;/sectionGroup&gt; &lt;/configSections&gt; &lt;dotNetOpenAuth&gt; &lt;!-- This is an optional configuration section where aspects of dotnetopenauth can be customized. --&gt; &lt;!-- For a complete set of configuration options see http://www.dotnetopenauth.net/developers/code-snippets/configuration-options/ --&gt; &lt;openid&gt; &lt;relyingParty&gt; &lt;security requireSsl="false"&gt; &lt;!-- Uncomment the trustedProviders tag if your relying party should only accept positive assertions from a closed set of OpenID Providers. --&gt; &lt;!--&lt;trustedProviders rejectAssertionsFromUntrustedProviders="true"&gt; &lt;add endpoint="https://www.google.com/accounts/o8/ud" /&gt; &lt;/trustedProviders&gt;--&gt; &lt;/security&gt; &lt;behaviors&gt; &lt;!-- The following OPTIONAL behavior allows RPs to use SREG only, but be compatible with OPs that use Attribute Exchange (in various formats). --&gt; &lt;add type="DotNetOpenAuth.OpenId.RelyingParty.Behaviors.AXFetchAsSregTransform, DotNetOpenAuth" /&gt; &lt;/behaviors&gt; &lt;/relyingParty&gt; &lt;/openid&gt; &lt;messaging&gt; &lt;untrustedWebRequest&gt; &lt;whitelistHosts&gt; &lt;!-- Uncomment to enable communication with localhost (should generally not activate in production!) --&gt; &lt;!--&lt;add name="localhost" /&gt;--&gt; &lt;/whitelistHosts&gt; &lt;/untrustedWebRequest&gt; &lt;/messaging&gt; &lt;!-- Allow DotNetOpenAuth to publish usage statistics to library authors to improve the library. --&gt; &lt;reporting enabled="true" /&gt; &lt;/dotNetOpenAuth&gt; </code></pre> <p><strong>Access AuthUserSession data</strong> </p> <p>In your ServiceStack service (class that inherits from Service) you can use: </p> <pre><code>var sess = this.GetSession(); </code></pre> <p>Outside of ServiceStack you can do something like: </p> <pre><code>var key = SessionFeature.GetSessionKey(); var sess = appHost.TryResolve&lt;ICacheClient&gt;().Get&lt;AuthUserSession&gt;(key); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload