MongoDB 3.2 authentication failed

Well, you’ll need to take couple of steps in sequence to create user successfully. First of all, you need to create an administrator user. I prefer creating super user. > use admin > db.createUser({user: “root”, pwd: “123456”, roles:[“root”]}) Restart your MongoDB server and enable authentication with –auth flag. > mongod –auth –port 27017 –dbpath /var/lib/mongodb … Read more

Java: how to use UrlConnection to post request with authorization?

A fine example found here. Powerlord got it right, below, for POST you need HttpURLConnection, instead. Below is the code to do that, URL url = new URL(urlString); URLConnection conn = url.openConnection(); conn.setDoOutput(true); conn.setRequestProperty (“Authorization”, encodedCredentials); OutputStreamWriter writer = new OutputStreamWriter(conn.getOutputStream()); writer.write(data); writer.flush(); String line; BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); while ((line = reader.readLine()) … Read more

Looking for a license key algorithm [closed]

There is no reliable licensing algorithm. Really. Not even one. For the most popular, most expensive proprietary software you can buy, you can also find “key generators” and hacked versions that don’t require licensing. Instead of worrying about making it “unbreakable”, just do something simple. A popular mechanism is to, at purchase, ask for the … Read more

Get ActionName, ControllerName and AreaName and pass it in ActionFilter Attribute

You could fetch them from the RouteData: protected override bool AuthorizeCore(System.Web.HttpContextBase httpContext) { var rd = httpContext.Request.RequestContext.RouteData; string currentAction = rd.GetRequiredString(“action”); string currentController = rd.GetRequiredString(“controller”); string currentArea = rd.Values[“area”] as string; … }

Which authentication and authorization schemes are you using – and why?

Actually, the answer is probably a combination of 1 and 3. You can take advantage of a lot of the tools and features that the framework provides for you by writing a membership, role or profile provider if the default options don’t quite go as far as you’d like. We’ve done just that on a … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)