summaryrefslogtreecommitdiffstats
path: root/base/common/src/com/netscape/certsrv/authority/AuthorityResource.java
blob: 0f8b70ade12c2b4174d5b9880a9c1bbeb35664cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
package com.netscape.certsrv.authority;

import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;

import org.jboss.resteasy.annotations.ClientResponseType;

import com.netscape.certsrv.acls.ACLMapping;
import com.netscape.certsrv.authentication.AuthMethodMapping;

@Path("authorities")
public interface AuthorityResource {

    public static final String HOST_AUTHORITY = "host-authority";

    @GET
    public Response listCAs();
    /*
            @QueryParam("start") Integer start,
            @QueryParam("size") Integer size);
            */

    @GET
    @Path("{id}")
    @ClientResponseType(entityType=AuthorityData.class)
    public Response getCA(@PathParam("id") String caIDString);

    @GET
    @Path("{id}/cert")
    @Produces("application/pkix-cert")
    @ClientResponseType(entityType=byte[].class)
    public Response getCert(@PathParam("id") String caIDString);

    @GET
    @Path("{id}/cert")
    @Produces("application/x-pem-file")
    @ClientResponseType(entityType=String.class)
    public Response getCertPEM(@PathParam("id") String caIDString);

    @GET
    @Path("{id}/chain")
    @Produces("application/pkcs7-mime")
    @ClientResponseType(entityType=byte[].class)
    public Response getChain(@PathParam("id") String caIDString);

    @GET
    @Path("{id}/chain")
    @Produces("application/x-pem-file")
    @ClientResponseType(entityType=String.class)
    public Response getChainPEM(@PathParam("id") String caIDString);

    @POST
    @ClientResponseType(entityType=AuthorityData.class)
    @AuthMethodMapping("authorities")
    @ACLMapping("authorities.create")
    public Response createCA(AuthorityData data);

    /**
     * Modify a CA (supports partial updates).
     *
     * isHostEnabled, authorityID, authorityParentID and DN are
     * immutable; differences in these values are ignored.
     *
     * Other values, if null, are ignored, otherwise they are
     * set to the new value.  To remove the description, use an
     * empty string.
     */
    @PUT
    @Path("{id}")
    @ClientResponseType(entityType=AuthorityData.class)
    @AuthMethodMapping("authorities")
    @ACLMapping("authorities.modify")
    public Response modifyCA(
        @PathParam("id") String caIDString,
        AuthorityData data);

    @POST
    @Path("{id}/enable")
    @ClientResponseType(entityType=AuthorityData.class)
    @AuthMethodMapping("authorities")
    @ACLMapping("authorities.modify")
    public Response enableCA(@PathParam("id") String caIDString);

    @POST
    @Path("{id}/disable")
    @ClientResponseType(entityType=AuthorityData.class)
    @AuthMethodMapping("authorities")
    @ACLMapping("authorities.modify")
    public Response disableCA(@PathParam("id") String caIDString);

    @POST
    @Path("{id}/renew")
    @ClientResponseType(entityType=AuthorityData.class)
    @AuthMethodMapping("authorities")
    @ACLMapping("authorities.modify")
    public Response renewCA(@PathParam("id") String caIDString);

    @DELETE
    @Path("{id}")
    @ClientResponseType(entityType=Void.class)
    @AuthMethodMapping("authorities")
    @ACLMapping("authorities.delete")
    public Response deleteCA(@PathParam("id") String caIDString);

}