Creating a Request Token using castle-sdk(v2.1.1) on .NET Framework (4.8.1) - .net-4.8

Unable to create request token using castle-sdk on .NET framework.
I am designing a plugin on .NET Framework and want to use castle-sdk for creating a request token, which will be used every time a user log in. Surfed around the web and found there are inbuilt functions available for browser-sdk(web), android and iOS. But I couldn't find any equivalent function on .NET framework.
Android code:
Castle - > createRequest Token Method
iOS code:
Castle - > createRequest Token Method

Related

SignalR .Net Core 3.1 unable to send object in SendAsync method from service class

Previously I was using .Net Core 2.2, I was able to send a json object from a service class using hub context and SendAsync method to a front end web client. Im having issues after I've upgraded my project framework to 3.1. If i call the SendAsync method using a json object, it will hit an error stating "{"The collection type 'Newtonsoft.Json.Linq.JObject' is not supported."}", if I send any other class object it will directly go to OnDisconnected.
Sample of the method i use
Using Json Object: await _hubContext.Clients.Group(groupName).SendAsync("NotificationResponse", jsonObject);
Using Class Object: await _hubContext.Clients.Group(groupName).SendAsync("NotificationResponse", notificationObject);
I've tried sending object directly from the hub, I was able to send a normal class object but not a json object. I did the testing on my project and also sample from this tutorial: https://learn.microsoft.com/en-us/aspnet/core/tutorials/signalr?view=aspnetcore-3.1&tabs=visual-studio
I posted this question on github and got the answer from BrennanConroy. Thanks alot !
His answer was:
2.1 was using Newtonsoft internally for Json, 3.1 uses System.Text.Json. If you're using features that don't work with System.Text.Json you can switch back to Newtonsoft https://learn.microsoft.com/aspnet/core/migration/22-to-30?view=aspnetcore-3.1&tabs=visual-studio#switch-to-newtonsoftjson
After doing this it fixed the issue.

Servicestack migration to core, fallback router and HandlerFactoryPath

Im migrating my code to a core application.
So far so good. i got it all running, but there is one problem.
I had a ui (with razor) and using the CatchAllHandlers. And for the api i used HandlerFactoryPath to prefix the urls.
Now i have 2 problems:
It seems CatchAllHandlers isn't used?
Route is only processed if route starts with HandlerFactoryPath?
The second issue is fixable but how would i go around the first one?
Do i make my own middle-ware or does servicestack support other ways of doing this?
CatchAllHandlers are executed in .NET Core, it's also what ServiceStack's new MVC RazorFormat uses to process Content Pages.
Specifying a HandlerFactoryPath, e.g:
SetConfig(new HostConfig {
HandlerFactoryPath = "api"
});
Tells ServiceStack that you only want to listen to requests from the /api path info. All other requests are passed through ServiceStack who calls the next module in .NET Core pipeline as per .NET Core's convention when it's not configured to handle a route.
Not sure if it's relevant to your solution but in ServiceStack .NET Core you can register a ServiceStack Handler in .NET Core module pipeline so you could for instance return a /default.cshtml Content Razor Page for each request that's not handled by ServiceStack, by registering it after ServiceStack:
app.UseServiceStack(new AppHost());
app.Use(new RazorHandler("/default"));

How does restangular talk to MySQL database

I am total JS newbie working on a project build in Grail 2.4.4, a web-app. It's a working app, build by a developer whom is not available anymore.
To get it to work locally I had to upgrade it to Grails 3.2.0. I got it almost working in Netbeans. But I got stuck at getting the data from the MySQL database.
The Chrome inspector says:
angular.min.js GET http://localhost:8080/<app>/currency/allCurrencies 404 ()
The controllers are written in Restangular which call the above URL.
What am I missing?
Firstly, Restangular is an Angular library which simplifies and standardizes making calls to a REST backend (which in your case is a Grails app). So, Restangular does not directly retrieve data from your a database, it invokes a web service which (in some cases) may retrieve data from a database.
In your case, Restangular is attempting to retrieve data from the endpoint http://localhost:8080/<app>/currency/allCurrencies but you are getting a 404 response, indicating that there is no endpoint mapped to this URL.
HTTP REST helps you connect to the API easily. Restangular can handle that by sending standard methods [Get, Post, Delete, Put] to the api like what you see.
This mean StudentController > Get()
localhost:2045/api/student
This mean StudentController > Get(Guid id)
localhost:2045/api/student/8ae37cfa-905b-4c71-ad03-bf416d93bdf8
This mean StudentController > POST(Guid id) ... if you send Post method to the API, it will detect it, this work also on put method
localhost:2045/api/student
use this module to get easily rest api.
Http-Rest-Service

How to create Restful api for mobile app in laravel 5.2

I'm creating an api for a mobile app in laravel version 5.2, but I don't have any idea how to return exception in JSON format. I've been doing api development and tested using chrome postman.
Please help me how can I start with laravel 5.2?
I can't understand how to set error response in laravel 5.2.
I've already tried below plugin, but still didn't succeed:
json-api with laravel,
dingo/api, it's work with laravel 4
How can we do authentication in laravel 5.2 from mobile app?
Something good references and video link so I can learn and development in laravel 5.2 very friendly.
For the creation of Restful API using Laravel 5.2 you could use below mention Laravel API generator Package .
https://github.com/InfyOmLabs/laravel-generator
As well as for the Authentication based on Token you could refer below mention Link.
https://gistlog.co/JacobBennett/090369fbab0b31130b51
One more additional thing if you have already created database / system and wants to use that for the creation of API using Laravel Generator package than use below mention command.
php artisan infyom:api_scaffold Packages --fromTable
--tableName=packages
Hope this information will help you to create complete Restful API using Laravel 5.2
I am also creating a Web Based Application for Android using Laravel 5.2 and we are using Rest API for this process. We are using API Guard for the purpose of Authentication. It works Perfect for us. We are authenticating it for Android as well as AngularJS and works fine for us. https://github.com/chrisbjr/api-guard. A Clear Documentation is Provided here. Hope so you have got your doubt cleared using this.

rpc lib for blackberry / j2me ( json / xml / * )

I'm trying to setup an rpc server so that a blackberry mobile app can make calls to it. Thought of trying out json first.
I've setup a working server side impl using http://jsonrpcphp.org/ .
Couldn't find any direct libs for blackberry/j2me. android-json-rpc looked interesting, but the blackberry SDK complains
"The type java.net.URI cannot be resolved. It is indirectly referenced from required .class files" at this line
HttpPost request = new HttpPost(serviceUri);
I'm using v4.1 of apache http core and client to make android-json-rpc work.
Looks like the URI class isn't bundled with the j2me/blackberry standard lib.
Is there a quick and dirty way to get rpc working on blackberry ? I don't mind xml or any thing else for the encoding, http is the transport I'm interested in.
BlackBerry 6 has built-in the JSON parser and some better APIs for making HTTP requests. Prior to that, though, you have to compile the JSON parser into your app and use the Java ME HttpConnection class to make and get the HTTP requests. So it depends what version you're targeting.
If you are targeting to < BB OS 6.0 devices.
You can also use org.json.me lib in your app.
Here is the sample named Implementing JSON in your application. It's very simple to use.
Good luck