예제 #1
0
        /**
         * Check authz before performing action.
         *
         * @param action desired action
         * @throws NotAuthorizedException thrown if user does not have role.
         */
        public void checkAuthorization(Action action, IncomingWebRequestContext context)   // throws NotAuthorizedException
        {
            string clientApplicationName = (string)context.GetType().GetProperty(RequestHandler.APPSENSOR_CLIENT_APPLICATION_IDENTIFIER_ATTR).ToString();

            ClientApplication clientApplication = appSensorServer.getConfiguration().findClientApplication(clientApplicationName);

            appSensorServer.getAccessController().assertAuthorized(clientApplication, action, new Context());
        }
예제 #2
0
        /**
         * Helper method to retrieve client application name.
         * This is set by the {@link ClientApplicationIdentificationFilter}
         *
         * @return client application name
         */
        private string getClientApplicationName()
        {
            string clientApplicationName = (string)requestContext.GetType().GetProperty(RequestHandler.APPSENSOR_CLIENT_APPLICATION_IDENTIFIER_ATTR).ToString();

            return(clientApplicationName);
        }