Esempio n. 1
0
        /// <summary>
        /// Get the user's profile.
        /// </summary>
        /// <returns></returns>
        public DataTransfer.OAuth2UserIdentity GetUserIdentity()
        {
            DataTransfer.OAuth2UserIdentity value =
                UnitOfWork.Execute <DataTransfer.OAuth2UserIdentity>(() =>
            {
                IOAuth2AuthorizationStoreAgent agent    = DependencyInjection.Get <IOAuth2AuthorizationStoreAgent>();
                Domain.Entity.OAuth2UserIdentity entity = agent.GetUserIdentity(Thread.CurrentPrincipal.Identity.Name);
                var _value = entity.ToDataTransferValue();

                return(_value);
            });

            return(value);
        }
        public static DataTransfer.OAuth2UserIdentity ToDataTransferValue(this Domain.Entity.OAuth2UserIdentity entity, params PropertyDirective[] directives)
        {
            DataTransfer.OAuth2UserIdentity value =
                new DataTransfer.OAuth2UserIdentity
                {
                    ID = entity.ID,
                    User = entity.User.ToDataTransferValue(),
                    Identity = entity.Identity.ToDataTransferValue(),

                    __references = entity.__references,
                    __extensions = entity.__extensions
                };

            return value;
        }
Esempio n. 3
0
        public static DataTransfer.OAuth2UserIdentity ToDataTransferValue(this Domain.Entity.OAuth2UserIdentity entity, params PropertyDirective[] directives)
        {
            DataTransfer.OAuth2UserIdentity value =
                new DataTransfer.OAuth2UserIdentity
            {
                ID       = entity.ID,
                User     = entity.User.ToDataTransferValue(),
                Identity = entity.Identity.ToDataTransferValue(),

                __references = entity.__references,
                __extensions = entity.__extensions
            };

            return(value);
        }
Esempio n. 4
0
        /// <summary>
        /// Sign up a new <see cref="OAuth2User"/> account.
        /// </summary>
        /// <param name="user">The <see cref="OAuth2User"/> data transfer object.</param>
        /// <returns>The registered <see cref="OAuth2User"/> account.</returns>
        public DataTransfer.OAuth2UserIdentity SignUpUser(OAuth2UserIdentity userIdentity)
        {
            DataTransfer.OAuth2UserIdentity value =
                UnitOfWork.Execute <DataTransfer.OAuth2UserIdentity>(() =>
            {
                IOAuth2AuthorizationStoreAgent agent           = DependencyInjection.Get <IOAuth2AuthorizationStoreAgent>();
                Domain.Entity.OAuth2UserIdentity _userIdentity = userIdentity.ToEntity();
                Domain.Entity.OAuth2UserIdentity entity        = agent.SignUpUser(_userIdentity);

                DataTransfer.OAuth2UserIdentity _value = entity.ToDataTransferValue();

                return(_value);
            });

            return(value);
        }
Esempio n. 5
0
        public static Domain.Entity.OAuth2UserIdentity ToEntity(this DataTransfer.OAuth2UserIdentity value)
        {
            Domain.Entity.OAuth2UserIdentity entity = null;

            if (!value.IsDefault())
            {
                entity = new Domain.Entity.OAuth2UserIdentity
                {
                    ID       = value.ID,
                    User     = value.User.ToEntity(),
                    Identity = value.Identity.ToEntity(),

                    __references = value.__references,
                    __extensions = value.__extensions
                };
            }

            return(entity);
        }