コード例 #1
0
        /// <summary>
        /// Saves a client to the database
        /// </summary>
        public void Commit()
        {
            Validate(); // will throw an exception as appropriate
            DBHelper dbh = new DBHelper("REPLACE INTO allowedoauthclients SET ClientID=?id, ClientSecret=?secret, CallBack=?callback, ClientName=?name, Scopes=?scopes, owningUserName=?user, ClientType=1");

            dbh.DoNonQuery((comm) =>
            {
                comm.Parameters.AddWithValue("id", ClientIdentifier.LimitTo(45));
                comm.Parameters.AddWithValue("secret", ClientSecret.LimitTo(255));
                comm.Parameters.AddWithValue("callback", CallbacksAsString.LimitTo(1024));
                comm.Parameters.AddWithValue("name", ClientName.LimitTo(255));
                comm.Parameters.AddWithValue("scopes", Scope.LimitTo(255));
                comm.Parameters.AddWithValue("user", OwningUser.LimitTo(255));
            });
            OAuth2AuthorizationServer.RefreshClients();
        }