Skip to content

Commit

Permalink
add authorisation lsitener
Browse files Browse the repository at this point in the history
  • Loading branch information
bradmac committed Jan 24, 2018
1 parent 661bedf commit 9bacade
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1800,9 +1800,18 @@ private Object findOrCreateObject(Class c) throws CreationException {
o = createObject(c);
}
return o;
}

public AuthorisationListener getAuthorisationListener() {
return authorisationListener;
}

public void setAuthorisationListener(AuthorisationListener authorisationListener) {
this.authorisationListener = authorisationListener;
}



public class CreationException extends Exception {

private final Class attemptedToCreate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
public interface AuthorisationListener {


void onAuthorisationResult(Request request, Request.Method method, Auth auth, boolean authorised);
boolean onAuthorisationResult(Request request, Request.Method method, Auth auth, boolean authorised);

}
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public boolean checkAuthorisation(HttpManager manager, Resource resource, Reques
boolean authorised = resource.authorise(request, method, auth);

if( authorisationListener != null ) {
authorisationListener.onAuthorisationResult(request, method, auth, authorised);
authorised = authorisationListener.onAuthorisationResult(request, method, auth, authorised);
}

if (!authorised) {
Expand Down

0 comments on commit 9bacade

Please sign in to comment.