-
-
Notifications
You must be signed in to change notification settings - Fork 114
Closed
Description
Given schema with custom directive:
type Query {
version: String @auth(roles: ["ROLE_VIEWER", "ROLE_GUEST"])
logs: [String] @auth(roles: ["ROLE_ADMIN"])
}
directive @auth (roles: [String] = ["viewer"]) on QUERY | MUTATION | SUBSCRIPTIONand graphql-java-codegen config:
<configuration>
...
<directiveAnnotationsMapping>
<auth>@org.springframework.security.access.annotation.Secured({{roles}})</auth>
</directiveAnnotationsMapping>
</configuration>Note: here {{roles}} will be replaced with the value of the corresponding @auth directive parameter roles.
Generated API resolvers will look like:
public interface VersionQueryResolver {
@org.springframework.security.access.annotation.Secured({"ROLE_VIEWER", "ROLE_GUEST"})
String version() throws Exception;
}
public interface LogsQueryResolver {
@org.springframework.security.access.annotation.Secured({"ROLE_ADMIN"})
java.util.List<String> logs() throws Exception;
}Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request