{"action":"created","issue":{"url":"https://api.github.com/repos/katharsis-project/katharsis-core/issues/194","repository_url":"https://api.github.com/repos/katharsis-project/katharsis-core","labels_url":"https://api.github.com/repos/katharsis-project/katharsis-core/issues/194/labels{/name}","comments_url":"https://api.github.com/repos/katharsis-project/katharsis-core/issues/194/comments","events_url":"https://api.github.com/repos/katharsis-project/katharsis-core/issues/194/events","html_url":"https://github.com/katharsis-project/katharsis-core/issues/194","id":121802580,"number":194,"title":"Support for @PermitAll, SecurityContext and related functionality","user":{"login":"joewildish","id":983099,"avatar_url":"https://avatars.githubusercontent.com/u/983099?v=3","gravatar_id":"","url":"https://api.github.com/users/joewildish","html_url":"https://github.com/joewildish","followers_url":"https://api.github.com/users/joewildish/followers","following_url":"https://api.github.com/users/joewildish/following{/other_user}","gists_url":"https://api.github.com/users/joewildish/gists{/gist_id}","starred_url":"https://api.github.com/users/joewildish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joewildish/subscriptions","organizations_url":"https://api.github.com/users/joewildish/orgs","repos_url":"https://api.github.com/users/joewildish/repos","events_url":"https://api.github.com/users/joewildish/events{/privacy}","received_events_url":"https://api.github.com/users/joewildish/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-12-11T22:14:47Z","updated_at":"2016-03-03T19:43:55Z","closed_at":"2015-12-14T19:17:06Z","body":"I am using Dropwizard (0.9.1) with Katharsis (2.1.1).\r\n\r\nLet's say I configure security on a (non-Katharsis) resource by using an AuthDynamicFeature and some annotations, like so:\r\n\r\n```java\r\n/* Main.java */\r\nenvironment.jersey().register(\r\n  new AuthDynamicFeature(\r\n    new OAuthCredentialAuthFilter.Builder<UserAccount>()\r\n      .setAuthenticator(new UserAuthenticator())\r\n      .setAuthorizer(new UserAuthorizer())\r\n      .setPrefix(\"SomePrefix\")\r\n      .buildAuthFilter())\r\n);\r\nenvironment.jersey().register(RolesAllowedDynamicFeature.class);\r\nenvironment.jersey().register(new AuthValueFactoryProvider.Binder<>(UserAccount.class));\r\n\r\n/* PingResource.java */\r\n@GET\r\n@PermitAll\r\npublic Pong get(@Context SecurityContext securityContext) {\r\n  UserAccount principal = (UserAccount) securityContext.getUserPrincipal();\r\n  return new Pong(principal.getName());\r\n}\r\n```\r\n\r\nI was expecting to be able to do the same on a ResourceRepository:\r\n\r\n```java\r\n@PermitAll\r\n@JsonApiFindAll\r\npublic Iterable<SomeResource> findAll(QueryParams queryParams, @Context SecurityContext security) {\r\n  /* ... */\r\n}\r\n```\r\n\r\nHowever it would seem that the Authentication mechanism is not being called when the GET request is made. Can you advise if what I'm trying to do is possible please?\r\n\r\nThanks.\r\n-Joe\r\n"},"comment":{"url":"https://api.github.com/repos/katharsis-project/katharsis-core/issues/comments/191931223","html_url":"https://github.com/katharsis-project/katharsis-core/issues/194#issuecomment-191931223","issue_url":"https://api.github.com/repos/katharsis-project/katharsis-core/issues/194","id":191931223,"user":{"login":"keithdmoore","id":954458,"avatar_url":"https://avatars.githubusercontent.com/u/954458?v=3","gravatar_id":"","url":"https://api.github.com/users/keithdmoore","html_url":"https://github.com/keithdmoore","followers_url":"https://api.github.com/users/keithdmoore/followers","following_url":"https://api.github.com/users/keithdmoore/following{/other_user}","gists_url":"https://api.github.com/users/keithdmoore/gists{/gist_id}","starred_url":"https://api.github.com/users/keithdmoore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keithdmoore/subscriptions","organizations_url":"https://api.github.com/users/keithdmoore/orgs","repos_url":"https://api.github.com/users/keithdmoore/repos","events_url":"https://api.github.com/users/keithdmoore/events{/privacy}","received_events_url":"https://api.github.com/users/keithdmoore/received_events","type":"User","site_admin":false},"created_at":"2016-03-03T19:43:55Z","updated_at":"2016-03-03T19:43:55Z","body":"If you are using Spring,  you can use Spring Security annotations.  This assuming you have added the RoleAuthorities as part of your authentication process.  https://docs.spring.io/spring-security/site/docs/current/reference/html/el-access.html.  "}}