On Sunday, 6 August 2017 at 16:47:14 UTC, holo wrote:
Hello

I'm trying to use auth framework with REST api ( http://vibed.org/api/vibe.web.auth/ ).

Is it possible to use it with registerRestInterface? According to description under: http://vibed.org/api/vibe.web.auth/requiresAuth it should be available on both Web and REST.

Here is my example code and compilation errors bellow:


[snip]

AuthInfo authenticate(scope HTTPServerRequest req, scope HTTPServerResponse res) @safe

[snip]


And im getting such errors:

ms-frontpage ~master: building configuration "application"...
../../.dub/packages/vibe-d-0.7.31/vibe-d/source/vibe/http/server.d(286,33): 
Deprecation: alias diet.traits.FilterCallback is deprecated - Use 
SafeFilterCallback instead.
source/app.d(14,31): Error: cannot create instance of interface IfOAuthAPI source/service/oauth.d(35,8): Error: @safe function 'oauth.OAuthAPI.authenticate' cannot call @system function 'vibe.http.session.Session.opCast'

[snip]

Are you aware what @safe does? If you remove it, it probably compiles.

From @safe functions you cannot call functions that are not marked @safe or @trusted [1].

Regards,
Bastiaan.

[1] https://dlang.org/spec/function.html#function-safety

Reply via email to