These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

[EveLib] A .NET library for EveXML, CREST, EveCentral, and more

First post
Author
Zetsubou Gakusei
Republic University
Minmatar Republic
#121 - 2014-12-10 18:52:54 UTC  |  Edited by: Zetsubou Gakusei
Icahmura Hasaki wrote:
Rhea should be fully supported already, as far as I'm aware. I just ran the unit tests and they all passed, though they are very rudimentary so there might be some missing data due to parsing errors still. I've just pushed a few minor crest related bugfixes to github that I'll get on nuget when I've accumulated a few more.

As for authed crest, I'm not sure how to incorporate it in a way that makes sence. Since the SSO requires a callback url and browser interaction and so on...

If anyone has ideas or suggestions for how I could incorporate it in a meaningful way, please let me know.


I'm not really an expert but I have had some experience with APIs such as facebook.
Facebook too has a web-only login, the popular .net APIs solve it by making the user open the facebook API login from a browser control popup, do the login and then getting back the returned token to the application.
I can't go into more detail because I don't really know how the backend works, I did use it this way and it works great with the .net browser control, non need for external implementations or anything.

I hope the same method (or a similar one) can apply with the SSO.

Also is there any reason this library shouldn't work with asp.net? In that environment it should be even easier to get the required auth tokens since the client is already in a browser (again, I'm not an expert so I could be saying something completely stupid)
Icahmura Hasaki
Perkone
Caldari State
#122 - 2014-12-10 19:37:00 UTC
What you're saying is perfectly doable, but I don't think it should be a part of the library. It's up to the library consumer to manage interaction with the end user, which includes managing the SSO authentication and handshakes and manage access tokens. Once you have the access token, that can be passed to EveLib and be used for authenticated CREST. But I'm not sure I want anything related to managing SSO and authentication to be included.

If anything I could create a separate library for that, but the SSO protocol is very straight forward and would only take a few minutes to code, so I'm not sure there's much value in it.

Developer of EveLib and EveAuthUtility

Zetsubou Gakusei
Republic University
Minmatar Republic
#123 - 2014-12-10 19:55:26 UTC
Icahmura Hasaki wrote:
What you're saying is perfectly doable, but I don't think it should be a part of the library. It's up to the library consumer to manage interaction with the end user, which includes managing the SSO authentication and handshakes and manage access tokens. Once you have the access token, that can be passed to EveLib and be used for authenticated CREST. But I'm not sure I want anything related to managing SSO and authentication to be included.

If anything I could create a separate library for that, but the SSO protocol is very straight forward and would only take a few minutes to code, so I'm not sure there's much value in it.


I see, so at least will you add the authed CREST endpoints?
Icahmura Hasaki
Perkone
Caldari State
#124 - 2014-12-10 20:00:47 UTC
Yeah, you will be able to use authed crest, but you'll have to get the access token elsewhere. I'm not really up to date on authed crest though, is it available yet ?

Developer of EveLib and EveAuthUtility

Zetsubou Gakusei
Republic University
Minmatar Republic
#125 - 2014-12-10 20:14:19 UTC
Icahmura Hasaki wrote:
Yeah, you will be able to use authed crest, but you'll have to get the access token elsewhere. I'm not really up to date on authed crest though, is it available yet ?

It came out with Rhea, it's already up and working and various devs are already implementing it in their applications, right now we got the market orders available for use
Icahmura Hasaki
Perkone
Caldari State
#126 - 2014-12-10 20:20:56 UTC
Oh, I see now. Give me a few minutes :)

Developer of EveLib and EveAuthUtility

Icahmura Hasaki
Perkone
Caldari State
#127 - 2014-12-10 20:39:43 UTC
So I got the auth working. I'll probably need a few days to do this properly, as I'm quite busy these days. I'll post back when I release it on Nuget :)

Developer of EveLib and EveAuthUtility

Icahmura Hasaki
Perkone
Caldari State
#128 - 2014-12-16 19:30:53 UTC
I've pushed a beta release to nuget, which brings Authed CREST and a lot of other improvements.
More importantly, the EveLib.EveCrest module is NOT fully backwards compatible. I've refactored a lot of the code and the models, but it shouldn't take long to find and fix the errors if you do update.

Major changes

  • Full support for authenticated CREST. Set a valid AccessToken and Mode to Authenticated on your EveCrest instance.
  • EveLib.EveAuth.EveSso: A very basic helper class for managing SSO.
  • EveCrest.Load() can be used to load any CrestHref or CrestLinkedEntity instances.
  • Added support for the versioning provided by CCP for Crest. Crest will now emit a warning for deprecated resources, and optionally throw an exception.
  • Added support for some additional Crest resources, more will come.
  • Lots of cleanup, more consistent naming scheme


Next on the list, I intend to improve on the Load() feature, adding a way to load the resource without having to pass it to an EveCrest instance. I would also like to implement deferred execution for CREST as a whole, possibly in a new module with no static entry points.

Developer of EveLib and EveAuthUtility

Zetsubou Gakusei
Republic University
Minmatar Republic
#129 - 2014-12-17 08:19:13 UTC  |  Edited by: Zetsubou Gakusei
Thanks for the update! I've been using the library in the past days and I've always been positively pleased. Can't wait to play with SSO now!

Is 2.0.5.2 the latest version? I'm not prompted for an update but I pulled the library yesterday from nuget so I'm not sure I have the latest one or not
Icahmura Hasaki
Perkone
Caldari State
#130 - 2014-12-17 08:38:00 UTC
No, 2.1.0-beta1 is the latest release. You have to select it manually on the Nuget page, or change the settings on your client to allow pre-releases. I'm currently working on it, so might have another version up by the end of the day.

Please let me know if you have any issues or if something's unclear with the new stuff :)

Developer of EveLib and EveAuthUtility

Zetsubou Gakusei
Republic University
Minmatar Republic
#131 - 2014-12-17 14:40:41 UTC  |  Edited by: Zetsubou Gakusei
After taking the whole morning to manage to figure out how to manually get the SSO token I looked into your source and found out that you implemented the whole token request part >_<

I was somehow under the impression that I had to do it myself for some reason and went ahead and did my own (awful) thing...

Also I laughed too hard at the "360 noscope" comment in the source, just letting you know
Icahmura Hasaki
Perkone
Caldari State
#132 - 2014-12-17 14:58:08 UTC
Been working at it all day, in fact :) Glad to hear you've found it useful though. Just finished up some last things now, before I'm done.

Got a lot of cool stuff coming, such as automatic token refreshes, lambda queryable crest resources and more.

Developer of EveLib and EveAuthUtility

Zetsubou Gakusei
Republic University
Minmatar Republic
#133 - 2014-12-17 15:04:54 UTC
Icahmura Hasaki wrote:
Been working at it all day, in fact :) Glad to hear you've found it useful though. Just finished up some last things now, before I'm done.

Got a lot of cool stuff coming, such as automatic token refreshes, lambda queryable crest resources and more.


I'm kind of stuck on the actual authentication right now, the application gets stuck right after I authenticate and try to retrieve values from the token, probably due to my inability to use await and async

I tried:

var authResult = EveSso.Authenticate(encodedAuth, code);

Response.Write(authResult.Result.AccessToken); //writing to the page the token so I can check it worked


I'm probably doing it wrong, what's the correct way?
Icahmura Hasaki
Perkone
Caldari State
#134 - 2014-12-17 15:09:10 UTC
That should work, all though it might hang a bit since you're not using await. Are you sure the encodedAuth and Code is correct? You have to manually copy the Code from your browser after logging in, if you're not doing that already.

Developer of EveLib and EveAuthUtility

Zetsubou Gakusei
Republic University
Minmatar Republic
#135 - 2014-12-17 15:10:41 UTC
Icahmura Hasaki wrote:
That should work, all though it might hang a bit since you're not using await. Are you sure the encodedAuth and Code is correct? You have to manually copy the Code from your browser after logging in, if you're not doing that already.

I'm doing that in asp.net so I already got the login and the callback working, the code is correct and the encoded value is right too, I just can't figure out how to use the async because I'm not very experienced on the subject
Icahmura Hasaki
Perkone
Caldari State
#136 - 2014-12-17 15:12:33 UTC  |  Edited by: Icahmura Hasaki
Well, it should work like that too. To test it async you can simply wrap it

public async void test(your parameters) {
var authResult = await EveSso.Authenticate(encodedAuth, code);
Response.Write(authResult.AccessToken); //writing to the page the token so I can check it worked

}

I've added much better error handling to EveAuth on github, that might help you out. The initial version that is on nuget was just a quick draft to get something working to test it out.

Drop by IRC, easier to communicate
http://irc.lc/coldfront/eve-dev/

Developer of EveLib and EveAuthUtility

Zetsubou Gakusei
Republic University
Minmatar Republic
#137 - 2014-12-17 15:23:20 UTC
Icahmura Hasaki wrote:
Well, it should work like that too. To test it async you can simply wrap it

public async void test(your parameters) {
var authResult = await EveSso.Authenticate(encodedAuth, code);
Response.Write(authResult.AccessToken); //writing to the page the token so I can check it worked

}

I've added much better error handling to EveAuth on github, that might help you out. The initial version that is on nuget was just a quick draft to get something working to test it out.

Drop by IRC, easier to communicate
http://irc.lc/coldfront/eve-dev/


I'm already on there actually, if you were online you probably should have seen my struggle through the day in getting this stuff to work
Icahmura Hasaki
Perkone
Caldari State
#138 - 2014-12-17 16:58:51 UTC
A new update is up no NuGet.

Since I've already made some breaking changes to the coming version, this includes a few more. I've done a major cleanup of namespaces and class names.
The EveOnline API module has NOT been changed at all.
All modules now live in their own namespace, instead of a common Modules namespace.
Most Model classes that had a Module prefix have had that removed, resulting in much shorter class names.
It should generally be easier to find the classes you need, and any capable IDE should be able to detect and fix the all the changes. All API methods and similar stay the same.

New features

  • EveCrest now supports refresh tokens with optional automatic refresh
  • EveCrest now supports a LINQ like query structure. EveCrest.GetRoot().QueryAsync(r => r.Alliances). Used EveCrest.Load() internally.
  • EveCrest.Load() has been improved.
  • EveAuth has been improved with better error handling, and a Verify(token) method.
  • Implemented ALL remaining CREST resources. Parsing bugs may still exist, please let me know.


If anyone wants to update but are afraid of things breaking, contact me and I'll help you out. The changes are very straight forward to fix, it's mostly just a matter of removing or adding a part of the name space or class name.

Developer of EveLib and EveAuthUtility

Icahmura Hasaki
Perkone
Caldari State
#139 - 2014-12-18 13:17:19 UTC  |  Edited by: Icahmura Hasaki
Another pre release is up. This fixes a bug as well as adding some features.

New features

  • You can now set an AuthedMaxConcurrentRequests and PublicMaxConcurrentRequests in EveCrest.RequestHandler.
  • You can now pass IEnumerables to EveCrest.Load() and CrestResource.Query().
  • Added sync wrappers for EveCrest.LoadAsync() and CrestResource.Query().
  • Improved error handling for EveAuth and EveCrest, including some special cases.
  • Improved token management, smarter automatic token refreshes
  • Implemented the last CREST resource, MarketOrders. CREST support should now be complete.
  • Implicit inferring of IDs for resource links if CREST doesn't return one explicitly. If no ID is set, it will attempt to extract one from the URI. You can check IsIdExplicit to see if the ID was set explicitly or not. If it was not explicit and inferring it failed (the resource doesn't have an id) the ID will be negative. I don't think this can occur with the current state of CREST, but you never know.


Bugfix: I fixed an issue with beta2 that caused all requests to use Authenticated mode.

Developer of EveLib and EveAuthUtility

Erik Kalkoken
The Congregation
RAPID HEAVY ROPERS
#140 - 2014-12-18 19:22:32 UTC
Great job! Will check it out on my next c# project.