authorization

Extend AuthorizeAttribute Override AuthorizeCore or OnAuthorization

允我心安 提交于 2019-11-26 19:30:48
问题 Using ASP.NET MVC I am creating a custom Authorize attribute to take care of some custom authorization logic. I have looked at a lot of examples and it is pretty straight forward but my question is which method is best to override, AuthorizeCore or OnAuthorization? I have seen many examples overriding one or the other. Is there a difference? 回答1: The clue is in the return types: AuthorizeCore returns a boolean - it is decision making code. This should be limited to looking at the user's

How to generate access token using refresh token through google drive API?

廉价感情. 提交于 2019-11-26 19:17:39
问题 I have completed steps of authorization and obtained access token and refresh token. What should I do next to generate access token using refresh token that I have stored through google drive API? I won't be able to use any sdk since I am working on Force.com so please suggest the way to implement it directly through the API. 回答1: If you want to implement that yourself, the OAuth 2.0 flow for Web Server Applications is documented at https://developers.google.com/accounts/docs/OAuth2WebServer,

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

青春壹個敷衍的年華 提交于 2019-11-26 18:36:31
I would like to generate POST request to a server which requires authentication. I tried to use the following method: private synchronized String CreateNewProductPOST (String urlString, String encodedString, String title, String content, Double price, String tags) { String data = "product[title]=" + URLEncoder.encode(title) + "&product[content]=" + URLEncoder.encode(content) + "&product[price]=" + URLEncoder.encode(price.toString()) + "&tags=" + tags; try { URL url = new URL(urlString); URLConnection conn; conn = url.openConnection(); conn.setRequestProperty ("Authorization", "Basic " +

Facebook deauthorization callback is not called

蹲街弑〆低调 提交于 2019-11-26 18:27:35
问题 I have an FB app, when I enter as the deauthorization callback URL my development box address, the box is pinged with this request after app removal on FB: POST /facebook/deauthorize HTTP/1.1 Host: bashman.org Accept: */* Content-Length: 261 Content-Type: application/x-www-form-urlencoded Connection: close fb_sig_uninstall=1&fb_sig_locale=de_DE&fb_sig_in_new_facebook=1&fb_sig_time=1322732591.2685&fb_sig_added=0&fb_sig_user=1476224117&fb_sig_country=de&fb_sig_api_key

ASP.NET MVC Forms Authentication + Authorize Attribute + Simple Roles

梦想与她 提交于 2019-11-26 18:11:22
I'm trying to add simple Authentication and Authorization to an ASP.NET MVC application. I'm just trying to tack on some added functionality to the basic Forms Authentication (due to simplicity and custom database structure) Assuming this is my database structure: User: username password role (ideally some enum. Strings if need be. Currently, user only has ONE role, but this might change) High Level Problem: Given the above database structure, I would like to be able to do the following: Simple Login using Forms Authentication Decorate my actions with: [Authorize(Roles={ MyRoles.Admin, MyRoles

Can't connect Nexus 4 to adb: unauthorized

丶灬走出姿态 提交于 2019-11-26 17:57:30
问题 I have a Nexus 4 with Android 4.3 and I am trying to connect the device to a computer with Windows 7 64bit. I installed the latest drivers and the latest adb version. I think I tried almost everything and I still get the following message: C:\Program Files (x86)\Android\sdk\platform-tools>adb devices List of devices attached 007667324ccb229b unauthorized What can be the reason for this error? 回答1: I had similar situation. Here is what I did: Try to check and uncheck the USB Debugging option

ASP.NET MVC - Alternative to Role Provider?

末鹿安然 提交于 2019-11-26 17:53:26
问题 I'm trying to avoid the use of the Role Provider and Membership Provider since its way too clumsy in my opinion, and therefore I'm trying to making my own "version" which is less clumsy and more manageable/flexible. Now is my question.. is there an alternative to the Role Provider which is decent? (I know that I can do custom Role provier, membership provider etc.) By more manageable/flexible I mean that I'm limited to use the Roles static class and not implement directly into my service

How to call a RESTful web service from Android?

耗尽温柔 提交于 2019-11-26 17:12:24
I have written a REST web service in Netbean IDE using Jersey Framework and Java. For every request the user needs to provide a username and a password, I know that this authentication is not a best practice (using a curl command like: curl -u username:password -X PUT http://localhsot:8080/user ). Now I want to call a REST web service from an Android Class. How should I do it? I have an Android Class which uses DefaultHttpClient and CredentialUsernameAndPassword , but when I run it in Eclipse, sometimes I get a runtime exception or SDK exception. Varghese John This is an sample restclient

Writing an authorization filter for my web app(JSF 2.0)

狂风中的少年 提交于 2019-11-26 16:57:07
问题 Following some advice, i decided to write my own authorization filter for my web app(I am not using container managed security so i have to do it this way). This is my first filter so i am a bit confused in how i should implement it. This is what i did so far: package filters; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax

Simple token based authentication/authorization in asp.net core for Mongodb datastore

一世执手 提交于 2019-11-26 16:45:22
问题 I need to implement pretty simple auth mechanizm with basically 2 roles: Owners and Users . And I think that having Enum for that will be enough. App itself is SPA with webapi implemented via Asp.net core. I saw article - how to implement it using EF Identity, but their models looks much more complex than I actually need and EF oriented to SQL db, and I using mongo. So my user will looks something like: class UserModel{ Id, Token, Roles: ["Owners", "Users"], ... } So what interfaces I need to