@@ -0,0 +1,1357 @@
+package uk.ac.ox.oucs.oauth.admin;%0A%0Aimport org.sakaiproject.authz.api.FunctionManager;%0Aimport org.sakaiproject.authz.api.SecurityService;%0Aimport org.sakaiproject.component.cover.ComponentManager;%0A%0Aimport javax.servlet.*;%0Aimport javax.servlet.http.HttpServletResponse;%0Aimport java.io.IOException;%0A%0A/**%0A * Filter users before displaying the oAuth administration page%0A */%0Apublic class AdminFilter implements Filter %7B%0A    private static final String OAUTH_ADMIN_RIGHT = %22oauth.admin%22;%0A    private SecurityService securityService;%0A%0A    @Override%0A    public void init(FilterConfig filterConfig) throws ServletException %7B%0A        FunctionManager functionManager = (FunctionManager) ComponentManager.get(FunctionManager.class);%0A        functionManager.registerFunction(OAUTH_ADMIN_RIGHT, false);%0A        securityService = (SecurityService) ComponentManager.get(SecurityService.class);%0A    %7D%0A%0A    @Override%0A    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException %7B%0A        if (securityService.unlock(OAUTH_ADMIN_RIGHT, %22%22)) %7B%0A            chain.doFilter(request, response);%0A        %7D else %7B%0A            HttpServletResponse res = (HttpServletResponse) response;%0A            res.sendError(HttpServletResponse.SC_UNAUTHORIZED);%0A        %7D%0A    %7D%0A%0A    @Override%0A    public void destroy() %7B%0A    %7D%0A%7D%0A

Create a filter to check if the user can access oAuth admin