javax.ws.rs.core.SecurityContext Java Examples

The following examples show how to use javax.ws.rs.core.SecurityContext. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BlueApi.java    From swaggy-jenkins with MIT License 6 votes vote down vote up
@GET
@Path("/rest/organizations/{organization}/pipelines/{pipeline}/runs")

@Produces({ "application/json" })
@io.swagger.annotations.ApiOperation(value = "", notes = "Retrieve all runs details for an organization pipeline", response = PipelineRuns.class, authorizations = {
    @io.swagger.annotations.Authorization(value = "jenkins_auth")
}, tags={ "blueOcean", })
@io.swagger.annotations.ApiResponses(value = { 
    @io.swagger.annotations.ApiResponse(code = 200, message = "Successfully retrieved runs details", response = PipelineRuns.class),
    
    @io.swagger.annotations.ApiResponse(code = 401, message = "Authentication failed - incorrect username and/or password", response = Void.class),
    
    @io.swagger.annotations.ApiResponse(code = 403, message = "Jenkins requires authentication - please set username and password", response = Void.class) })
public Response getPipelineRuns( @PathParam("organization") String organization, @PathParam("pipeline") String pipeline,@Context SecurityContext securityContext)
throws NotFoundException {
    return service.getPipelineRuns(organization,pipeline,securityContext);
}
 
Example #2
Source File: QuestionnairResource.java    From gazpachoquest with GNU General Public License v3.0 6 votes vote down vote up
@POST
@Path("/{questionnaireId}/answer")
@Consumes(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Allow the respondent save answers")
@ApiResponses(value = { @ApiResponse(code = 404, message = "Invalid invitation token supplied"),
        @ApiResponse(code = 200, message = "Answer saved correctly") })
public Response saveAnswer(@ApiParam(value = "Answer", required = true)
Answer answer, @Context
final SecurityContext context, @PathParam("questionnaireId")
@ApiParam(value = "Questionnair id", required = true)
Integer questionnaireId, @QueryParam("questionCode")
@ApiParam(value = "Question Code", required = true)
String questionCode) {
    logger.debug("New attempt for saving answer from {}", context.getUserPrincipal().getName());
    try {
        questionnairFacade.saveAnswer(questionnaireId, questionCode, answer);
    } catch (Exception e) {
        logger.error(e.getMessage(), e);
        throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR);
    }
    return Response.ok().build();
}
 
Example #3
Source File: ServiceConfigurationCatalogResource.java    From streamline with Apache License 2.0 6 votes vote down vote up
@POST
@Path("/services/{serviceId}/configurations")
@Timed
public Response addServiceConfiguration(@PathParam("serviceId") Long serviceId, ServiceConfiguration serviceConfiguration,
                                        @Context SecurityContext securityContext) {
    SecurityUtil.checkPermissions(authorizer, securityContext, Cluster.NAMESPACE, getClusterId(serviceId), WRITE);
    // just overwrite the service id to given path param
    serviceConfiguration.setServiceId(serviceId);

    Service service = environmentService.getService(serviceId);
    if (service == null) {
        throw EntityNotFoundException.byId("service: " + serviceId.toString());
    }

    String configurationName = serviceConfiguration.getName();
    ServiceConfiguration result = environmentService.getServiceConfigurationByName(serviceId, configurationName);
    if (result != null) {
        throw EntityAlreadyExistsException.byName("service id " +
            serviceId + " and configuration name " + configurationName);
    }

    ServiceConfiguration createdConfiguration = environmentService.addServiceConfiguration(serviceConfiguration);
    return WSUtils.respondEntity(createdConfiguration, CREATED);
}
 
Example #4
Source File: TopologyActionResource.java    From streamline with Apache License 2.0 6 votes vote down vote up
@POST
@Path("/topologies/{topologyId}/versions/{versionId}/actions/suspend")
@Timed
public Response suspendTopologyVersion(@PathParam("topologyId") Long topologyId,
                                       @PathParam("versionId") Long versionId,
                                       @Context SecurityContext securityContext) throws Exception {
    SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_SUPER_ADMIN,
            NAMESPACE, topologyId, READ, EXECUTE);
    Topology result = catalogService.getTopology(topologyId, versionId);
    if (result != null) {
        actionsService.suspendTopology(result, WSUtils.getUserFromSecurityContext(securityContext));
        return WSUtils.respondEntity(result, OK);
    }

    throw EntityNotFoundException.byVersion(topologyId.toString(), versionId.toString());
}
 
Example #5
Source File: PetApi.java    From openapi-generator with Apache License 2.0 6 votes vote down vote up
@POST
    @Path("/{petId}/uploadImage")
    @Consumes({ "multipart/form-data" })
    @Produces({ "application/json" })
    @io.swagger.annotations.ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = {
        @io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
            @io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
            @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
        })
    }, tags={ "pet", })
    @io.swagger.annotations.ApiResponses(value = { 
        @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
    public Response uploadFile(@ApiParam(value = "ID of pet to update", required = true) @PathParam("petId") @NotNull  Long petId
,@ApiParam(value = "Additional data to pass to server")@FormDataParam("additionalMetadata")  String additionalMetadata
,
            @FormDataParam("file") InputStream fileInputStream,
            @FormDataParam("file") FormDataContentDisposition fileDetail
,@Context SecurityContext securityContext)
    throws NotFoundException {
        return delegate.uploadFile(petId, additionalMetadata, fileInputStream, fileDetail, securityContext);
    }
 
Example #6
Source File: JerseySpringTest.java    From gravitee-management-rest-api with Apache License 2.0 6 votes vote down vote up
@Override
public void filter(final ContainerRequestContext requestContext) throws IOException {
    requestContext.setSecurityContext(new SecurityContext() {
        @Override
        public Principal getUserPrincipal() {
            return () -> USER_NAME;
        }
        @Override
        public boolean isUserInRole(String string) {
            return true;
        }
        @Override
        public boolean isSecure() { return true; }
        @Override
        public String getAuthenticationScheme() { return "BASIC"; }
    });
}
 
Example #7
Source File: ComponentCatalogResource.java    From streamline with Apache License 2.0 6 votes vote down vote up
@PUT
@Path("/services/{serviceId}/components")
@Timed
public Response addOrUpdateComponent(@PathParam("serviceId") Long serviceId, Component component,
                                     @Context SecurityContext securityContext) {
    SecurityUtil.checkPermissions(authorizer, securityContext, Cluster.NAMESPACE, getClusterId(serviceId), WRITE);
    // overwrite service id to given path param
    component.setServiceId(serviceId);

    Service service = environmentService.getService(serviceId);
    if (service == null) {
        throw EntityNotFoundException.byId("service: " + serviceId.toString());
    }

    Component createdComponent = environmentService.addOrUpdateComponent(serviceId, component);
    return WSUtils.respondEntity(createdComponent, CREATED);
}
 
Example #8
Source File: BlueApi.java    From swaggy-jenkins with MIT License 6 votes vote down vote up
@GET
@Path("/rest/users/{user}/favorites")

@Produces({ "application/json" })
@io.swagger.annotations.ApiOperation(value = "", notes = "Retrieve user favorites details for an organization", response = UserFavorites.class, authorizations = {
    @io.swagger.annotations.Authorization(value = "jenkins_auth")
}, tags={ "blueOcean", })
@io.swagger.annotations.ApiResponses(value = { 
    @io.swagger.annotations.ApiResponse(code = 200, message = "Successfully retrieved users favorites details", response = UserFavorites.class),
    
    @io.swagger.annotations.ApiResponse(code = 401, message = "Authentication failed - incorrect username and/or password", response = Void.class),
    
    @io.swagger.annotations.ApiResponse(code = 403, message = "Jenkins requires authentication - please set username and password", response = Void.class) })
public Response getUserFavorites( @PathParam("user") String user,@Context SecurityContext securityContext)
throws NotFoundException {
    return service.getUserFavorites(user,securityContext);
}
 
Example #9
Source File: PathApi.java    From swagger-aem with Apache License 2.0 6 votes vote down vote up
@POST
    @Path("/{name}.rw.html")
    
    
    @io.swagger.annotations.ApiOperation(value = "", notes = "", response = Void.class, authorizations = {
        @io.swagger.annotations.Authorization(value = "aemAuth")
    }, tags={ "sling", })
    @io.swagger.annotations.ApiResponses(value = { 
        @io.swagger.annotations.ApiResponse(code = 200, message = "Default response", response = Void.class) })
    public Response postNodeRw(@ApiParam(value = "",required=true) @PathParam("path") String path
,@ApiParam(value = "",required=true) @PathParam("name") String name
,@ApiParam(value = "") @QueryParam("addMembers") String addMembers
,@Context SecurityContext securityContext)
    throws NotFoundException {
        return delegate.postNodeRw(path,name,addMembers,securityContext);
    }
 
Example #10
Source File: SchemaRegistryResource.java    From registry with Apache License 2.0 6 votes vote down vote up
@GET
@Path("/schemas/{name}/branches")
@ApiOperation(value = "Get list of registered schema branches",
        response = SchemaBranch.class, responseContainer = "List",
        tags = OPERATION_GROUP_OTHER)
@Timed
@UnitOfWork
public Response getAllBranches(@ApiParam(value = "Details about schema name",required = true) @PathParam("name") String schemaName,
                               @Context UriInfo uriInfo,
                               @Context SecurityContext securityContext) {
    try {
        Collection<SchemaBranch> schemaBranches = authorizationAgent.authorizeGetAllBranches(AuthorizationUtils.getUserAndGroups(securityContext),
                schemaRegistry, schemaName, schemaRegistry.getSchemaBranches(schemaName));
        return WSUtils.respondEntities(schemaBranches, Response.Status.OK);
    }  catch(SchemaNotFoundException e) {
        return WSUtils.respond(Response.Status.NOT_FOUND, CatalogResponse.ResponseMessage.ENTITY_NOT_FOUND, schemaName);
    } catch (Exception ex) {
        LOG.error("Encountered error while listing schema branches", ex);
        return WSUtils.respond(Response.Status.INTERNAL_SERVER_ERROR, CatalogResponse.ResponseMessage.EXCEPTION, ex.getMessage());
    }
}
 
Example #11
Source File: TopologyTestRunResource.java    From streamline with Apache License 2.0 5 votes vote down vote up
@GET
@Path("/topologies/{topologyId}/testhistories/{historyId}")
@Timed
public Response getHistoryOfTestRunTopology (@Context UriInfo urlInfo,
                                             @PathParam("topologyId") Long topologyId,
                                             @PathParam("historyId") Long historyId,
                                             @QueryParam("simplify") Boolean simplify,
                                             @Context SecurityContext securityContext) throws Exception {
    SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER,
            Topology.NAMESPACE, topologyId, READ);

    TopologyTestRunHistory history = catalogService.getTopologyTestRunHistory(historyId);

    if (history == null) {
        throw EntityNotFoundException.byId(String.valueOf(historyId));
    }

    if (!history.getTopologyId().equals(topologyId)) {
        throw BadRequestException.message("Test history " + historyId + " is not belong to topology " + topologyId);
    }

    if (BooleanUtils.isTrue(simplify)) {
        return WSUtils.respondEntity(new SimplifiedTopologyTestRunHistory(history), OK);
    } else {
        return WSUtils.respondEntity(history, OK);
    }
}
 
Example #12
Source File: JRestlessHandlerContainerIntTest.java    From jrestless with Apache License 2.0 5 votes vote down vote up
@Test
public void getArticle_NonSupportedAccept_ShouldReturnNotAcceptable() throws IOException {
	when(testService.getArticle(1)).thenReturn("some article");
	JRestlessResponseWriter responseWriter = createResponseWriterMock();
	TestRequest req = new TestRequest("/articles/1", "GET");
	req.getHeadersAsMultimap().add("Accept", MediaType.APPLICATION_XML);
	container.handleRequest(req, responseWriter, mock(SecurityContext.class));
	verify(responseWriter, times(1)).writeResponse(eq(Status.NOT_ACCEPTABLE), any(), emptyBaos());
}
 
Example #13
Source File: NoClassLevelWithUnconstrainedMethodEndpoint.java    From thorntail with Apache License 2.0 5 votes vote down vote up
@GET
@Path("/echo")
@RolesAllowed("Echoer")
public String echo(@Context SecurityContext sec, @QueryParam("input") String input) {
    Principal user = sec.getUserPrincipal();
    return input + ", user="+user.getName();
}
 
Example #14
Source File: UserApi.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
@GET
    @Path("/login")
    
    @Produces({ "application/xml", "application/json" })
    @io.swagger.annotations.ApiOperation(value = "Logs user into the system", notes = "", response = String.class, tags={ "user", })
    @io.swagger.annotations.ApiResponses(value = { 
        @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = String.class),
        
        @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username/password supplied", response = Void.class) })
    public Response loginUser(@ApiParam(value = "The user name for login", required = true) @QueryParam("username") @NotNull  String username
,@ApiParam(value = "The password for login in clear text", required = true) @QueryParam("password") @NotNull  String password
,@Context SecurityContext securityContext)
    throws NotFoundException {
        return delegate.loginUser(username, password, securityContext);
    }
 
Example #15
Source File: AuthorizationFilter.java    From realworld-api-quarkus with MIT License 5 votes vote down vote up
private boolean isAccessAllowed(List<Role> allowedRoles, SecurityContext securityContext) {
  for (Role allowedRole : allowedRoles) {
    if (securityContext.isUserInRole(allowedRole.name())) {
      return true;
    }
  }
  return false;
}
 
Example #16
Source File: WebIdSecurityContextTest.java    From trellis with Apache License 2.0 5 votes vote down vote up
@Test
void testAdminRoles() {
    final SecurityContext mockDelegate = mock(SecurityContext.class);
    final String iss = "https://example.com/idp/";
    final String sub = "acoburn";
    final JwtClaims claims = new JwtClaims();
    claims.setSubject(sub);
    claims.setIssuer(iss);
    final JsonWebToken principal = new DefaultJWTCallerPrincipal(claims);

    final SecurityContext ctx = new WebIdSecurityContext(mockDelegate, principal, singleton(iss + sub));
    assertTrue(ctx.isUserInRole(WebIdSecurityContext.ADMIN_ROLE));
    assertFalse(ctx.isUserInRole("other-role"));
}
 
Example #17
Source File: FakeApi.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
@POST
    @Path("/outer/composite")
    
    @Produces({ "*/*" })
    @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", })
    @io.swagger.annotations.ApiResponses(value = { 
        @io.swagger.annotations.ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) })
    public Response fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body") @Valid  OuterComposite body
,@Context SecurityContext securityContext)
    throws NotFoundException {
        return delegate.fakeOuterCompositeSerialize(body, securityContext);
    }
 
Example #18
Source File: TokenSecuredResourceV4.java    From quarkus-quickstarts with Apache License 2.0 5 votes vote down vote up
@GET()
@Path("permit-all")
@PermitAll
@Produces(MediaType.TEXT_PLAIN)
public String hello(@Context SecurityContext ctx) {
    Principal caller = ctx.getUserPrincipal();
    String name = caller == null ? "anonymous" : caller.getName();
    String helloReply = String.format("hello + %s, isSecure: %s, authScheme: %s", name, ctx.isSecure(),
            ctx.getAuthenticationScheme());
    return helloReply;
}
 
Example #19
Source File: StoreApi.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
@GET
@Path("/inventory")

@Produces({ "application/json" })
@io.swagger.annotations.ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = {
    @io.swagger.annotations.Authorization(value = "api_key")
}, tags={ "store",  })
@io.swagger.annotations.ApiResponses(value = { 
    @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") })
public Response getInventory(
    @Context SecurityContext securityContext)
throws NotFoundException {
    return delegate.getInventory(securityContext);
}
 
Example #20
Source File: ManagerResource.java    From datacollector with Apache License 2.0 5 votes vote down vote up
@Path("/pipeline/{pipelineId}/stop")
@POST
@ApiOperation(value = "Stop Pipeline", response = PipelineStateJson.class,
  authorizations = @Authorization(value = "basic"))
@Produces(MediaType.APPLICATION_JSON)
@RolesAllowed({
    AuthzRole.MANAGER,
    AuthzRole.ADMIN,
    AuthzRole.MANAGER_REMOTE,
    AuthzRole.ADMIN_REMOTE
})
public Response stopPipeline(
  @PathParam("pipelineId") String pipelineId,
  @QueryParam("rev") @DefaultValue("0") String rev,
  @Context SecurityContext context
) throws PipelineException {
  PipelineInfo pipelineInfo = store.getInfo(pipelineId);
  RestAPIUtils.injectPipelineInMDC(pipelineInfo.getTitle(), pipelineInfo.getPipelineId());
  if (manager.isRemotePipeline(pipelineId, rev) && !context.isUserInRole(AuthzRole.ADMIN) &&
      !context.isUserInRole(AuthzRole.ADMIN_REMOTE)) {
    throw new PipelineException(ContainerError.CONTAINER_01101, "STOP_PIPELINE", pipelineId);
  }
  Runner runner = manager.getRunner(pipelineId, rev);
  Utils.checkState(runner.getState().getExecutionMode() != ExecutionMode.SLAVE,
    "This operation is not supported in SLAVE mode");
  runner.stop(user);
  return Response.ok()
      .type(MediaType.APPLICATION_JSON)
      .entity(BeanHelper.wrapPipelineState(runner.getState())).build();
}
 
Example #21
Source File: LoginResource.java    From presto with Apache License 2.0 5 votes vote down vote up
@ResourceSecurity(WEB_UI)
@POST
@Path(UI_LOGIN)
public Response login(
        @FormParam("username") String username,
        @FormParam("password") String password,
        @FormParam("redirectPath") String redirectPath,
        @Context SecurityContext securityContext)
{
    username = emptyToNull(username);
    password = emptyToNull(password);
    redirectPath = emptyToNull(redirectPath);

    if (!formWebUiAuthenticationManager.isAuthenticationEnabled(securityContext.isSecure())) {
        return Response.seeOther(DISABLED_LOCATION_URI).build();
    }

    Optional<NewCookie> authenticationCookie = formWebUiAuthenticationManager.checkLoginCredentials(username, password, securityContext.isSecure());
    if (!authenticationCookie.isPresent()) {
        // authentication failed, redirect back to the login page
        return Response.seeOther(LOGIN_FORM_URI).build();
    }

    return redirectFromSuccessfulLoginResponse(redirectPath)
            .cookie(authenticationCookie.get())
            .build();
}
 
Example #22
Source File: BlueApi.java    From swaggy-jenkins with MIT License 5 votes vote down vote up
@GET
@Path("/rest/search/")

@Produces({ "application/json" })
@io.swagger.annotations.ApiOperation(value = "", notes = "Search for any resource details", response = String.class, authorizations = {
    @io.swagger.annotations.Authorization(value = "jenkins_auth")
}, tags={ "blueOcean", })
@io.swagger.annotations.ApiResponses(value = { 
    @io.swagger.annotations.ApiResponse(code = 200, message = "Successfully retrieved search result", response = String.class),
    
    @io.swagger.annotations.ApiResponse(code = 401, message = "Authentication failed - incorrect username and/or password", response = Void.class),
    
    @io.swagger.annotations.ApiResponse(code = 403, message = "Jenkins requires authentication - please set username and password", response = Void.class) })
public Response search( @NotNull @QueryParam("q") String q,@Context SecurityContext securityContext);
 
Example #23
Source File: SecurityCatalogResource.java    From streamline with Apache License 2.0 5 votes vote down vote up
@POST
@Path("/roles")
@Timed
public Response addRole(Role role, @Context SecurityContext securityContext) {
    SecurityUtil.checkRole(authorizer, securityContext, ROLE_SECURITY_ADMIN);
    Role createdRole = catalogService.addRole(role);
    return WSUtils.respondEntity(createdRole, CREATED);
}
 
Example #24
Source File: BlueApi.java    From swaggy-jenkins with MIT License 5 votes vote down vote up
@GET
@Path("/rest/organizations/{organization}/scm/{scm}")

@Produces({ "application/json" })
@io.swagger.annotations.ApiOperation(value = "", notes = "Retrieve SCM details for an organization", response = GithubScm.class, authorizations = {
    @io.swagger.annotations.Authorization(value = "jenkins_auth")
}, tags={ "blueOcean", })
@io.swagger.annotations.ApiResponses(value = { 
    @io.swagger.annotations.ApiResponse(code = 200, message = "Successfully retrieved SCM details", response = GithubScm.class),
    
    @io.swagger.annotations.ApiResponse(code = 401, message = "Authentication failed - incorrect username and/or password", response = Void.class),
    
    @io.swagger.annotations.ApiResponse(code = 403, message = "Jenkins requires authentication - please set username and password", response = Void.class) })
public Response getSCM( @PathParam("organization") String organization, @PathParam("scm") String scm,@Context SecurityContext securityContext);
 
Example #25
Source File: ConfigApi.java    From netphony-topology with Apache License 2.0 5 votes vote down vote up
@GET
@Path("/networks/network/{networkId}/node/{nodeId}/")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@io.swagger.annotations.ApiOperation(value = "Retrieve node by ID", notes = "Retrieve operation of resource: node", response = NodeSchema.class, tags={  })
@io.swagger.annotations.ApiResponses(value = { 
    @io.swagger.annotations.ApiResponse(code = 200, message = "Successful operation", response = NodeSchema.class),
    @io.swagger.annotations.ApiResponse(code = 400, message = "Internal Error", response = NodeSchema.class) })
public Response retrieveNetworksNetworkNodeNodeById(
    @ApiParam(value = "ID of networkId",required=true) @PathParam("networkId") String networkId,
    @ApiParam(value = "ID of nodeId",required=true) @PathParam("nodeId") String nodeId,
    @Context SecurityContext securityContext)
throws NotFoundException {
    return delegate.retrieveNetworksNetworkNodeNodeById(networkId,nodeId,securityContext);
}
 
Example #26
Source File: StoreApi.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
@GET
@Path("/inventory")

@Produces({ "application/json" })
@io.swagger.annotations.ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = {
    @io.swagger.annotations.Authorization(value = "api_key")
}, tags={ "store", })
@io.swagger.annotations.ApiResponses(value = { 
    @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") })
public Response getInventory(@Context SecurityContext securityContext);
 
Example #27
Source File: PetApi.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
@DELETE
@Path("/{petId}")


@io.swagger.annotations.ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = {
    @io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
        @io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
        @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
    })
}, tags={ "pet", })
@io.swagger.annotations.ApiResponses(value = { 
    @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) })
public Response deletePet( @PathParam("petId") Long petId,  @ApiParam(value = "" ) @HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext);
 
Example #28
Source File: SecurityCatalogResource.java    From streamline with Apache License 2.0 5 votes vote down vote up
@PUT
@Path("/acls/{id}")
@Timed
public Response addOrUpdateAcl(@PathParam("id") Long aclId, AclEntry aclEntry, @Context SecurityContext securityContext) {
    mayBeFillSidId(aclEntry);
    checkAclOp(aclEntry, securityContext, this::shouldAllowAclAddOrUpdate);
    AclEntry newAclEntry = catalogService.addOrUpdateAcl(aclId, aclEntry);
    return WSUtils.respondEntity(newAclEntry, OK);
}
 
Example #29
Source File: FakeClassnameTestApi.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
@PATCH
    
    @Consumes({ "application/json" })
    @Produces({ "application/json" })
    @io.swagger.annotations.ApiOperation(value = "To test class name in snake case", notes = "To test class name in snake case", response = Client.class, authorizations = {
        @io.swagger.annotations.Authorization(value = "api_key_query")
    }, tags={ "fake_classname_tags 123#$%^", })
    @io.swagger.annotations.ApiResponses(value = { 
        @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) })
    public Response testClassname(@ApiParam(value = "client model", required = true) @NotNull @Valid  Client body
,@Context SecurityContext securityContext)
    throws NotFoundException {
        return delegate.testClassname(body, securityContext);
    }
 
Example #30
Source File: NamespaceCatalogResource.java    From streamline with Apache License 2.0 5 votes vote down vote up
@PUT
@Path("/namespaces/{id}")
@Timed
public Response addOrUpdateNamespace(@PathParam("id") Long namespaceId,
    Namespace namespace, @Context SecurityContext securityContext) {
  SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_ENVIRONMENT_SUPER_ADMIN,
          Namespace.NAMESPACE, namespaceId, WRITE);
  try {
    Namespace newNamespace = environmentService.addOrUpdateNamespace(namespaceId, namespace);
    return WSUtils.respondEntity(newNamespace, OK);
  } catch (ProcessingException ex) {
    throw BadRequestException.of();
  }
}