Create a Mashery API Definition that can be accessed without authentication - authentication

I manage to create so many API Definition that always using oauth 2 or Api Key, but how to create a definition without any authorization (just link as is) ? like a deeplink or shortened url that no need any authorization.
I see custom options but don'e know how to use it.
Any advise welcome,
thank you
Regards,
Sigit

In Mashery, open endpoints are created using a workaround method.
Keep the request authentication method as 'API Key'
Using a common(or a default) account, create a custom key with value noapikey for the package-plan under with the endpoint will be exposed
In the endpoint level setting, the is a setting called 'Allow calls having no API Key`. Set that value to true.
Now the endpoint will be accessible with out any authentication
The logic is that all the calls without an Api Key is mapped to this default noapikey, which means we need to take care of the throttle and call limits for the default key.

Related

Is it okay to call multiple microservices from your authorization microservice?

I want to add authorization details about objects, sort of like roles associated to each object in my application as claims in my jwts. So is the right way to do this by adding calls from my issuer to the individual microservices that deal with the particular object or some other way to ensure what permissions the user has with the particular object. How would I dissociate the access token upon a change in the permissions instantly?
I have a object called namespaces that holds multiple different objects inside it, would I add API calls from the sub objects microservice to the object microservice to ensure valid permissions? But then I wouldn't be able to add it to my API gateway?
For reference I'm using
Django Rest Framework Simple JWT for login
I would also like to add token authentication to integrate with other clients but that's something I'd like to do in the future.

API Keys Symfony and JWT Authentication

My question is more about logical understanding than in my code itself (at the moment).
I created an API with Symfony and thanks to the tutorial on KahereCode.
I have now 2 possible clients, an application and a website.
I have some resources that must be public, for example the creation of user implies that my POST point of USER is public.
Currently, I have JWT Authentication bundle that returns a JWT token for the endpoints I have set as private.
This allows to identify the user and to limit the data to his own.
Only, isn't it possible to add an API Key in addition to this in order to identify my 2 clients and to limit the access to public resources to these two?
I would like to avoid, by leaving the endpoints completely public and vulnerable, that someone could launch a script to send data to a public POST endpoint that would overload the API, and even create unwanted users. (Well, I could still manage that with an email verification).
Can anyone help me understand how to set this up or point me to an alternative to what I'm presenting here?

Azure Mobile App refreshing tokens on server

Here's the background:
Need to authenticate with google/facebook/msa
Need to add our own claims to MobileServiceAuthenticationToken for use on client
Want to have refresh token capabilities (I know FB doesn't have that)
I have this working by LoginAsync and getting a MobileServiceAuthenticationToken back. Then I call a custom auth controller which has an [Authorize] attribute on it.
The custom auth controller copies some claims from the principal then adds our claims to those and creates a new token which it returns to the client.
Using the LoginAsync for all of this keeps the tokens flowing for all calls and that's great.
So, the token expires and I call RefreshUserAsync on the client. At this point the MobileServiceAuthenticationToken with our custom claims is replaced by the default one from the MobileAppService without our claims. I expect that.
So now I have to call the custom auth controller again to get our claims added back to the identity token.
This works, but it feels clumsy. And it's two round trips.
What I'm looking for is to refresh the identity provider access token on the server side, and in the same method, update the identity token with our stuff.
I'm aware of the /.auth/refresh call from the client side as an alternative to RefreshUserAsync. Is there a similar call I can make from my controller in the backend without setting up the whole System.Net.Http.HttpClient thing?
For example: I use this.User.GetAppServiceIdentityAsync<GoogleCredentials>( this.Request ) in the backend to get identity provider information without making HTTP calls.
Something like that?
Thanks in advance.
Short version - no.
Longer version - you need to call the /.auth/refresh on the backend on behalf of the user, then add your claims. The /.auth endpoints are on a different service that your backend does not have access to except via Http.
The GetAppServiceIdentityAsync() method still does a HttpClient call, so you aren't saving yourself a round trip.

Thinktecture Identity Server claims

I'm using Thinktecture Identity Server V3 for authentication and having a problem getting the information from HttpContext.Current.User.
I'm using an API to handle calls but when I call HttpContext.Current.User the ID is not avilable only the claims set by Identity server.
Also when I make a call through signalR the hubs HttpContext.Current.User is null and I can't get the users ID or even look at the cliams.
I'm currently using a custom user service hooked into AspNetIdentity and overriding PostAuthenticateLocalAsync and trying to use the user manager to CreateIdentityAsync but this fails.
Is there any way to populate the default claims on login and retrieve the details on a signalr connection and Web API call?
Thanks
Did you end up solving this?
I'm still pretty new to Thinktecture Identity Server, but I'm going to take a stab at this.
There is an option IncludeAllClaimsForUser on the Scope which is set to false by default. Based on what I'm reading, this option will remove the filter when calling the GetProfileAsync() endpoint.
Here's some links on where I found this info:
http://identityserver.github.io/Documentation/docs/configuration/scopesAndClaims.html
https://github.com/IdentityServer/IdentityServer3/issues/621
No I had to park it until I had time to figure it out.
I did use the IncludeAllClaimsForUser property on the scope which would populate the claims. The issue I had was that User.Identity.GetUserId() would always return null as this is now set within the claim "sub".
This was not such a big issue but when I passed through a bearer token on a signalR connection, Current.User is always null and I can't even read the "sub" claim.
Its like the bearer token is not being validated on a signalR connection so I can't get the users details.
Thanks for the help, its much appreciated.

How to use the Photobucket REST API?

Has anyone successfully used the Photobucket REST API? According to the pathetic docs, it requires OAuth authorization, which would require a consumer key and secret, but registering an app gives you but a single developer key, which I have no idea what to do with.
If you go into photobucket and go to your application and view the details, you will see there is a developer key and what they call a 'private' key. I would assume this is the secret you are looking for. If you manage to make a successful call to the photobucket API, I would appreciate if you could provide the URL you used (anonymize anything private like the signature, of course)