authorization

HasFlag not recognizing role assignment

心已入冬 提交于 2019-12-06 05:10:57
I'm using an Enum decorated with [Flags] to control autoization within my MVC2 app. Below is my code examples: [Flags] public enum SecurityRoles { None = 0, Executive = 1, BackOffice = 2, AccountManager = 4, Consultant = 8, Administrator = 16 } [TestMethod] public void MultipleSelectionsTest() { var requiredRoles = SecurityRoles.Executive | SecurityRoles.BackOffice; var user1Roles = SecurityRoles.Executive | SecurityRoles.Administrator | SecurityRoles.BackOffice | SecurityRoles.Consultant; var user1HasAccess = user1Roles.HasFlag(requiredRoles); var user2Roles = SecurityRoles.Administrator |

WCF net.tcp bindings, message formats and security questions

大城市里の小女人 提交于 2019-12-06 05:07:55
问题 sorry for the stupid questions but there are just some things about WCF I cant get my head around. Would be greatful for some advice on the following.... At a very basic level is it correct that WCF uses either Binary (Net.Tcp), HTTP or MSMQ to transfer my message on the wire? However is it true that in all cases, regardless of how the data is transferred the message itself in in the SOAP format with headers and a body? So its a sort of XML message that is transmitted in either HTTP/S or in a

Add Retrofit Requestinterceptor with Dagger at runtime

痴心易碎 提交于 2019-12-06 04:17:54
I'm using dagger and retrofit. I inject my Retrofit services with Dagger. Now i wanna do a authorization request to get an accessToken. Afterwards i want to enhance my api module with an Request interceptor to use this access token for future requests. My idea is to use the ObjectGraph.plus() method after i received the access token, but i'm not sure if this is the best way to do it. Can someone point me to the right direction or maybe is there an example project on github ? The key is to always add the RequestInterceptor and then change whether or not it adds the header. class ApiHeaders

wcf data contracts authorization

好久不见. 提交于 2019-12-06 04:10:24
问题 how to use [PrincipalPermission(SecurityAction.Demand, Role = "Administrators")] attribute on a class? I am looking for some way to restrict the access on my object i.e if some object is being accessed in a service method and if the user has rights for accessing the service method but does not have rights accessing the object an exception should be thrown 回答1: PrincipalPermission attribute can adorn method or class. Therefore it is possible to restrict access to an instance of an object.

JAX-RS: Custom SecurityContext has unexpected type when injected into resource method

青春壹個敷衍的年華 提交于 2019-12-06 04:05:39
I have implemented a ContainerRequestFilter that performs JWT-based authentication: @Provider @Priority(Priorities.AUTHENTICATION) public class AuthenticationFilter implements ContainerRequestFilter { @Override public void filter(ContainerRequestContext requestContext) throws IOException { AuthenticationResult authResult = ... if (authResult.isSuccessful()) { // Client successfully authenticated. // Now update the security context to be the augmented security context that contains information read from the JWT. requestContext.setSecurityContext(new JwtSecurityContect(...)); } else { // Client

Google App Scripts curl authorization

瘦欲@ 提交于 2019-12-06 03:49:03
Just trying to play with google app scripts. In anonymous mode things seem fine. Except that anyone can call my script simply like that snippet shows: curl "https://script.google.com/macros/s/.../exec?ip=\"$myIp\"" I used this manual for tips on how to authenticate through GoogleLogin. The problem is "401 Unauthorized" I received when sent auth token and "Me(owner)/Only myself" options were set on google side. (The token seems correct itself. If I omit password or mistype it, then I receive "Bad auth") If I set "Anyone, even anonymous" again, it works, but auth stuff seems like ignored. What's

Redirect to AccessDenied page when user is not authorized

Deadly 提交于 2019-12-06 03:48:22
问题 I have created a custom AuthorizationAttribute which I'm placing on my controllers. I followed this article. I've implemented custom authorization logic in the OnAuthorization method and this works fine. When the user fails authorization I'm currently doing the following: // if authorization check fails... filterContext.Result = new HttpUnauthorizedResult(); This displays a username/password prompt. My question is what is the recommended way send the user to a "Access Is Denied" type page

What username does the kubernetes kubelet use when contacting the kubernetes API?

不想你离开。 提交于 2019-12-06 03:33:14
So I've been trying to implement ABAC authorization in the kubernetes API, with the following arguments in my kube-api manifest file. - --authorization-mode=ABAC - --authorization-policy-file=/etc/kubernetes/auth/abac-rules.json And the following content in the abac-rulse.json file. {"apiVersion": "abac.authorization.kubernetes.io/v1beta1", "kind": "Policy", "spec": {"user":"*", "nonResourcePath": "*", "readonly": true}} {"apiVersion": "abac.authorization.kubernetes.io/v1beta1", "kind": "Policy", "spec": {"user":"admin", "namespace": "*", "resource": "*", "apiGroup": "*" }} {"apiVersion":

Pyramid and FormAlchemy admin interface

ⅰ亾dé卋堺 提交于 2019-12-06 03:25:17
问题 I have a pyramid project using the formalchemy admin interface. I added the basic ACL authentication and the pyramid_formalchemy plugin always denys even though I am authenticated. Any thoughts on how only allow authenticated users to use the pyramid_formalchemy admin interface? The authorization policy was add like this: authn_policy = AuthTktAuthenticationPolicy('MYhiddenSECRET', callback=groupfinder) authz_policy = ACLAuthorizationPolicy() config = Configurator( settings=settings, root

How to set HTTP Request Header “authentication” using HTTPClient?

痴心易碎 提交于 2019-12-06 03:14:55
I want to set the HTTP Request header "Authorization" when sending a POST request to a server. How do I do it in Java? Does HttpClient have any support for it? http://www.w3.org/Protocols/HTTP/HTRQ_Headers.html#z9 The server requires me to set some specific value for the authorization field: of the form ID:signature which they will then use to authenticate the request. Thanks Ajay Below is the example for setting request headers HttpPost post = new HttpPost("someurl"); post.addHeader(key1, value1)); post.addHeader(key2, value2)); Here is the code for a Basic Access Authentication : HttpPost