Why does this check to see if user is authorized to edit a post fail for all but super admins?

I’m trying to determine if a piece of content can be edited by a user. I would like all roles contributor and above to be authorized by a single check. Here’s my code: if( empty( $post_id ) || !current_user_can(‘edit_post’, $post_id) ) { return; } Unfortunately, the only users that don’t get the return are super … Read more

Why does AuthorizeAttribute redirect to the login page for authentication and authorization failures?

In ASP.NET MVC, you can mark up a controller method with AuthorizeAttribute, like this: [Authorize(Roles = “CanDeleteTags”)] public void Delete(string tagName) { // … } This means that, if the currently logged-in user is not in the “CanDeleteTags” role, the controller method will never be called. Unfortunately, for failures, AuthorizeAttribute returns HttpUnauthorizedResult, which always returns … Read more

How to define the basic HTTP authentication using cURL correctly?

I’m learning Apigility (Apigility docu -> REST Service Tutorial) and trying to send a POST request with basic authentication via cURL: $ curl -X POST -i -H “Content-Type: application/hal+json” -H “Authorization: Basic YXBpdXNlcjphcGlwd2Q=” http://apigilityhw.sandbox.loc/status YXBpdXNlcjphcGlwd2Q= is the base 64 encoded string with my credentials apiuser:apipwd. The credentials are saved in the /data/htpasswd (apiuser:$apr1$3J4cyqEw$WKga3rQMkxvnevMuBaekg/). The looks … Read more

How does ifttt.com authenticate a supplied WordPress account

I’m curious to know how ifttt.com authenticate a supplied WordPress admin login credentials. And after authorization is granted, how does it publish post on our behalf? am curious to know what communication protocol it is using. 1 Answer 1 IFTTT.com connects to your WordPress site via XML-RPC, as the dudes at wpbeginner.com already found out: … Read more

What is the purpose of having a token in cookies?

WordPress utilizes cookies for better security, and I’ve been trying to understand how exactly this could make a WordPress website more secure, and I found this article . There’s a pretty decent explanation, but it concerns the 3.9 version, so it’s a little bit outdated. I compared the sources of the current WordPress code and … Read more

How do you create a custom AuthorizeAttribute in ASP.NET Core?

I’m trying to make a custom authorization attribute in ASP.NET Core. In previous versions it was possible to override bool AuthorizeCore(HttpContextBase httpContext). But this no longer exists in AuthorizeAttribute. What is the current approach to make a custom AuthorizeAttribute? What I am trying to accomplish: I am receiving a session ID in the Header Authorization. … Read more

Authentication versus Authorization

What’s the difference in context of web applications? I see the abbreviation “auth” a lot. Does it stand for auth-entication or auth-orization? Or is it both? 17 s 17 Authentication is the process of ascertaining that somebody really is who they claim to be. Authorization refers to rules that determine who is allowed to do … Read more

Best Practices for securing a REST API / web service [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 years ago. Improve this question When designing a REST API or service are there any established best practices for dealing with … Read more