Ejemplo n.º 1
0
        private static ApiKey CreateFromFilter(IQueryFilter filter, Database database = null)
        {
            Database db  = database ?? Db.For <ApiKey>();
            var      dao = new ApiKey();

            filter.Parameters.Each(p =>
            {
                dao.Property(p.ColumnName, p.Value);
            });
            dao.Save(db);
            return(dao);
        }
Ejemplo n.º 2
0
        public static ApiKey AddKey(Application app, IUserResolver userResolver, IHttpContext context, Database database = null)
        {
            ApiKey key = app.ApiKeysByApplicationId.AddNew();

            key.ClientId     = GetClientId(app.Name);
            key.Disabled     = false;
            key.SharedSecret = ServiceProxySystem.GenerateId();
            key.CreatedBy    = userResolver.GetUser(context);
            key.CreatedAt    = new Instant();
            key.Save(database);
            return(key);
        }
Ejemplo n.º 3
0
 public ActionResult Update(Bam.Net.ServiceProxy.Secure.ApiKey dao)
 {
     try
     {
         dao.Save();
         return(Json(new { Success = true, Message = "", Dao = dao.ToJsonSafe() }));
     }
     catch (Exception ex)
     {
         return(GetErrorResult(ex));
     }
 }