Skip to content

Commit

Permalink
Ensure consistency between requiresAuth and authenticate.
Browse files Browse the repository at this point in the history
  • Loading branch information
s-ludwig committed Sep 27, 2017
1 parent f69ebd1 commit 460a8b2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions web/vibe/web/auth.d
Expand Up @@ -245,6 +245,8 @@ package template AuthInfo(C, CA = C)
static if (is(typeof(ATTS[idx])) && isInstanceOf!(RequiresAuthAttribute, typeof(ATTS[idx]))) {
static if (is(typeof(C.init.authenticate(HTTPServerRequest.init, HTTPServerResponse.init)))) {
alias impl = typeof(C.init.authenticate(HTTPServerRequest.init, HTTPServerResponse.init));
static assert(is(ATTS[idx].AuthInfo == void) || is(ATTS[idx].AuthInfo == impl),
"Type mismatch between the @requiresAuth annotation and the authenticate() method.");
} else static if (is(C == interface)) {
alias impl = ATTS[idx].AuthInfo;
static assert(!is(impl == void), "Interface "~C.stringof~" either needs to supply an authenticate method or must supply the authentication information via @requiresAuth!T.");
Expand Down

0 comments on commit 460a8b2

Please sign in to comment.