Should clients get OAuth 2 access tokens using GET or POST?

The most common argument is that you should not put sensitive information in a query string (GET parameter) as Web servers typically log the HTTP request URL. POST data can be arbitrarily long, so is not usually logged. Therefore when you’re dealing with something like client_secret or code (although it’s one time use), it makes … Read more

Should authorization be part of the model or controller?

I think this is a grey area. One could argue that the user access is part of the mapping between the HTTP world and the Object-Oriented world. This is what the controller is intended for (hence the heavy use of statics), to transform the incoming request, ready to process the business rules on the domain … Read more

Custom function throws a “You do not have the permission required to setValue” error

from the documentation : Custom functions return values, but they cannot set values outside the cells they are in. In most circumstances, a custom function in cell A1 cannot modify cell A5. However, if a custom function returns a double array, the results overflow the cell containing the function and fill the cells below and … Read more

Spring Security @PreAuthorization pass enums in directly

Indeed you can implement a custom strongly typed security annotation, though this is rather bothersome. Declare your annotation enum Permission { USER_LIST, USER_EDIT, USER_ADD, USER_ROLE_EDIT } @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) @interface Permissions { Permission[] value(); } Declare the custom implementation of org.springframework.security.access.ConfigAttribute to be used by security pipeline class SecurityAttribute implements ConfigAttribute { private final List<Permission> permissions; … Read more

What is the appropriate way to manage API secrets within a Google Apps script?

There is no right or wrong answer. There are numerous factors to consider: If this is for/in G-Suite, then your G-Suite admins’ll have (or can get) access to anything. This may or may not be an issue. If you put the data in a sheet, anyone that has read access to the sheet can see … Read more

How to get user name using Windows authentication in asp.net?

These are the different variables you have access to and their values, depending on the IIS configuration. Scenario 1: Anonymous Authentication in IIS with impersonation off. HttpContext.Current.Request.LogonUserIdentity.Name SERVER1\IUSR_SERVER1 HttpContext.Current.Request.IsAuthenticated False HttpContext.Current.User.Identity.Name – System.Environment.UserName ASPNET Security.Principal.WindowsIdentity.GetCurrent().Name SERVER1\ASPNET Scenario 2: Windows Authentication in IIS, impersonation off. HttpContext.Current.Request.LogonUserIdentity.Name MYDOMAIN\USER1 HttpContext.Current.Request.IsAuthenticated True HttpContext.Current.User.Identity.Name MYDOMAIN\USER1 System.Environment.UserName ASPNET Security.Principal.WindowsIdentity.GetCurrent().Name SERVER1\ASPNET Scenario … Read more

How do I unit test a controller method that has the [Authorize] attribute applied?

You need to mock a context for your controller. Try using Moq Your arrange would then look like: var controller = new UserController(); var mock = new Mock<ControllerContext>(); mock.SetupGet(x => x.HttpContext.User.Identity.Name).Returns(“SOMEUSER”); mock.SetupGet(x => x.HttpContext.Request.IsAuthenticated).Returns(true); controller.ControllerContext = mock.Object; You should be able to then do your Act & Assert. If you haven’t already, I would highly … Read more

Stackoverflow’s use of localstorage for Authorization seems unsafe. Is this correct else how do we strengthen it?

Well, rather than looking at the vulnerability, let’s look at the possible attack vectors. I’ll add a table here as a TL/DR Attacker | Vulnerable? Eavesdropper | Yes MITM | Yes Local Attack | Yes Server Attack | Yes So yes, it is an issue. Remote Attacker, can observe traffic, but cannot modify traffic Consider … Read more

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