示例#1
0
 public void Init()
 {
     urlResolver      = new global::BlackBarLabs.Web.Utilities.Tests.Doubles.Fakes.UrlResolver();
     responseModifier = new ResponseModifier();
     context          = new Context(() =>
     {
         const string connectionStringKeyName = "Azure.Authorization.Storage";
         return(new Persistence.Azure.DataContext(connectionStringKeyName));
     },
                                    (providerMethod) => new CredentialProvider.Doubles.Stubs.StubCredentialProvider((provider, username, token) =>
                                                                                                                    credentialResponse(provider, username, token)));
 }
示例#2
0
        public async Task <IEnumerable <CredentialModel> > ResolveAsync(Context context, HttpVerbs httpVerb,
                                                                        IResolveUrls routeResolver, IModifyResponse responseModifier)
        {
            throw new NotImplementedException();
            //    IBusinessSocialIdentity socialIdentity;
            //    var socialIdenties = new List<IBusinessSocialIdentity>();

            //    Go find the parent that this belongs to and make sure the parent exists.
            //    var userIdentity = await context.FindUserIdentityByIdAsync(UserIdentityId);
            //    if (userIdentity == null)
            //        throw this.PreconditionViewModelEntityNotFound();

            //    if (HttpVerbs.Get == httpVerb)
            //    {
            //        if (default(Guid) == Id)
            //        {
            //            socialIdenties.AddRange(await userIdentity.SocialIdentityAsync());
            //        }
            //        else
            //        {
            //            socialIdentity = await userIdentity.FindSocialIdentityByIdAsync(Id);
            //            if (null != socialIdentity)
            //            {
            //                socialIdenties.Add(socialIdentity);
            //            }
            //        }
            //        if (!socialIdenties.Any()) throw this.PreconditionViewModelEntityNotFound();

            //        var tasks = socialIdenties.Select(t => ToViewModelAsync(t, urlHelper, requestContext));
            //        return await Task.WhenAll(tasks);
            //    }

            //    socialIdentity = await userIdentity.FindSocialIdentityByIdAsync(Id);
            //    if (HttpVerbs.Post == httpVerb)
            //    {
            //        if (null != socialIdentity)
            //        {
            //            throw this.PreconditionViewModelEntityAlreadyExists();
            //        }

            //        await userIdentity.CreateSocialIdentityAsync(this.Id, this.AppId, this.Type, this.Method, this.UserId, this.Provider, this.Token);

            //        requestContext.SetResponseCode(HttpStatusCode.Created);
            //        requestContext.AddLocationHeader(requestContext.GetEndPointUrl(urlHelper, "SocialIdentity", Id));
            //        return new SocialIdentityModel[] { };

            //    }

            //    if (HttpVerbs.Put == httpVerb)
            //    {
            //        if (null == socialIdentity)
            //        {
            //            throw this.PreconditionViewModelEntityNotFound();
            //        }

            //        await socialIdentity.UpdateToken(this.Token);

            //        requestContext.SetResponseCode(HttpStatusCode.NoContent);
            //        requestContext.AddLocationHeader(requestContext.GetEndPointUrl(urlHelper, "SocialIdentity", Id));
            //        return new SocialIdentityModel[] { };
            //    }
        }