8000 Add operationId to Admin REST API for OpenAPI spec generation by klahap · Pull Request #39011 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ public OrganizationIdentityProvidersResource(KeycloakSession session, Organizati
@Tag(name = KeycloakOpenAPI.Admin.Tags.ORGANIZATIONS)
@Operation(summary = "Adds the identity provider with the specified id to the organization",
description = "Adds, or associates, an existing identity provider with the organization. If no identity provider is found, " +
"or if it is already associated with the organization, an error response is returned")
"or if it is already associated with the organization, an error response is returned",
operationId = "addIdentityProvider"
)
@RequestBody(description = "Payload should contain only id or alias of the identity provider to be associated with the organization " +
"(id or alias with or without quotes). Surrounding whitespace characters will be trimmed.", required = true)
@APIResponses(value = {
Expand Down Expand Up @@ -107,7 +109,10 @@ public Response addIdentityProvider(String id) {
@Produces(MediaType.APPLICATION_JSON)
@NoCache
@Tag(name = KeycloakOpenAPI.Admin.Tags.ORGANIZATIONS)
@Operation(summary = "Returns all identity providers associated with the organization")
@Operation(
summary = "Returns all identity providers associated with the organization",
operationId = "getIdentityProviders"
)
@APIResponses(value = {
@APIResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = IdentityProviderRepresentation.class, type = SchemaType.ARRAY)))
})
Expand All @@ -122,7 +127,9 @@ public Stream<IdentityProviderRepresentation> getIdentityProviders() {
@Tag(name = KeycloakOpenAPI.Admin.Tags.ORGANIZATIONS)
@Operation(summary = "Returns the identity provider associated with the organization that has the specified alias",
description = "Searches for an identity provider with the given alias. If one is found and is associated with the " +
"organization, it is returned. Otherwise, an error response with status NOT_FOUND is returned")
"organization, it is returned. Otherwise, an error response with status NOT_FOUND is returned",
operationId = "getIdentityProvider"
)
@APIResponses(value = {
@APIResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = IdentityProviderRepresentation.class))),
@APIResponse(responseCode = "404", description = "Not Found")
Expand All @@ -143,7 +150,9 @@ public IdentityProviderRepresentation getIdentityProvider(@PathParam("alias") St
@Tag(name = KeycloakOpenAPI.Admin.Tags.ORGANIZATIONS)
@Operation(summary = "Removes the identity provider with the specified alias from the organization",
description = "Breaks the association between the identity provider and the organization. The provider itself is not deleted. " +
"If no provider is found, or if it is not currently associated with the org, an error response is returned")
"If no provider is found, or if it is not currently associated with the org, an error response is returned",
operationId = "deleteIdentityProvider"
)
@APIResponses(value = {
@APIResponse(responseCode = "204", description = "No Content"),
@APIResponse(responseCode = "400", description = "Bad Request"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ public OrganizationMemberResource(KeycloakSession session, OrganizationModel org
@Tag(name = KeycloakOpenAPI.Admin.Tags.ORGANIZATIONS)
@Operation(summary = "Adds the user with the specified id as a member of the organization", description = "Adds, or associates, " +
"an existing user with the organization. If no user is found, or if it is already associated with the organization, " +
"an error response is returned")
"an error response is returned",
operationId = "addMember"
)
@RequestBody(description = "Payload should contain only id of the user to be added to the organization (UUID with or without quotes). " +
"Surrounding whitespace characters will be trimmed.", required = true)
@APIResponses(value = {
Expand Down Expand Up @@ -126,7 +128,9 @@ public Response addMember(String id) {
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Tag(name = KeycloakOpenAPI.Admin.Tags.ORGANIZATIONS)
@Operation(summary = "Invites an existing user or sends a registration link to a new user, based on the provided e-mail address.",
description = "If the user with the given e-mail address exists, it sends an invitation link, otherwise it sends a registration link.")
description = "If the user with the given e-mail address exists, it sends an invitation link, otherwise it sends a registration link.",
operationId = "inviteUser"
)
@APIResponses(value = {
@APIResponse(responseCode = "204", description = "No Content"),
@APIResponse(responseCode = "400", description = "Bad Request"),
Expand All @@ -143,7 +147,10 @@ public Response inviteUser(@FormParam("email") String email,
@Path("invite-existing-user")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Tag(name = KeycloakOpenAPI.Admin.Tags.ORGANIZATIONS)
@Operation(summary = "Invites an existing user to the organization, using the specified user id")
@Operation(
summary = "Invites an existing user to the organization, using the specified user id",
operationId = "inviteExistingUser"
)
@APIResponses(value = {
@APIResponse(responseCode = "204", description = "No Content"),
@APIResponse(responseCode = "400", description = "Bad Request"),
Expand All @@ -157,7 +164,10 @@ public Response inviteExistingUser(@FormParam("id") String id) {
@Produces(MediaType.APPLICATION_JSON)
@NoCache
@Tag(name = KeycloakOpenAPI.Admin.Tags.ORGANIZATIONS)
@Operation( summary = "Returns a paginated list of organization members filtered according to the specified parameters")
@Operation(
summary = "Returns a paginated list of organization members filtered according to the specified parameters",
operationId = "searchMember"
)
@APIResponses(value = {
@APIResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = MemberRepresentation.class, type = SchemaType.ARRAY)))
})
Expand Down Expand Up @@ -188,7 +198,9 @@ public Stream<MemberRepresentation> search(
@Tag(name = KeycloakOpenAPI.Admin.Tags.ORGANIZATIONS)
@Operation( summary = "Returns the member of the organization with the specified id", description = "Searches for a" +
"user with the given id. If one is found, and is currently a member of the organization, returns it. Otherwise," +
"an error response with status NOT_FOUND is returned")
"an error response with status NOT_FOUND is returned",
operationId = "getMember"
)
@APIResponses(value = {
@APIResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = MemberRepresentation.class))),
@APIResponse(responseCode = "400", description = "Bad Request")
Expand All @@ -206,7 +218,9 @@ public MemberRepresentation get(@PathParam("member-id") String memberId) {
@Tag(name = KeycloakOpenAPI.Admin.Tags.ORGANIZATIONS)
@Operation(summary = "Removes the user with the specified id from the organization", description = "Breaks the association " +
"between the user and organization. The user itself is deleted in case the membership is managed, otherwise the user is not deleted. " +
"If no user is found, or if they are not a member of the organization, an error response is returned")
"If no user is found, or if they are not a member of the organization, an error response is returned",
operationId = "deleteMember"
)
@APIResponses(value = {
@APIResponse(responseCode = "204", description = "No Content"),
@APIResponse(responseCode = "400", description = "Bad Request")
Expand Down Expand Up @@ -236,7 +250,10 @@ public Response delete(@PathParam("member-id") String memberId) {
@Produces(MediaType.APPLICATION_JSON)
@NoCache
@Tag(name = KeycloakOpenAPI.Admin.Tags.ORGANIZATIONS)
@Operation(summary = "Returns the organizations associated with the user that has the specified id")
@Operation(
summary = "Returns the organizations associated with the user that has the specified id",
operationId = "getOrganizations"
)
@APIResponses(value = {
@APIResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = OrganizationRepresentation.class, type = SchemaType.ARRAY))),
@APIResponse(responseCode = "400", description = "Bad Request")
Expand All @@ -256,7 +273,7 @@ public Stream<OrganizationRepresentation> getOrganizations(@PathParam("member-id
@Produces(MediaType.APPLICATION_JSON)
@NoCache
@Tag(name = KeycloakOpenAPI.Admin.Tags.ORGANIZATIONS)
@Operation( summary = "Returns number of members in the organization.")
@Operation(summary = "Returns number of members in the organization.", operationId = "countMembers")
@APIResponses(value = {
@APIResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = Long.class)))
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public OrganizationResource(KeycloakSession session, OrganizationModel organizat
@NoCache
@Produces(MediaType.APPLICATION_JSON)
@Tag(name = KeycloakOpenAPI.Admin.Tags.ORGANIZATIONS)
@Operation(summary = "Returns the organization representation")
@Operation(summary = "Returns the organization representation", operationId = "getOrganization")
@APIResponses(value = {
@APIResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = OrganizationRepresentation.class)))
})
Expand All @@ -78,7 +78,7 @@ public OrganizationRepresentation get() {

@DELETE
@Tag(name = KeycloakOpenAPI.Admin.Tags.ORGANIZATIONS)
@Operation(summary = "Deletes the organization")
@Operation(summary = "Deletes the organization", operationId = "deleteOrganization")
@APIResponses(value = {
@APIResponse(responseCode = "204", description = "No Content"),
@APIResponse(responseCode = "400", description = "Bad Request")
Expand All @@ -96,7 +96,7 @@ public Response delete() {
@PUT
@Consumes(MediaType.APPLICATION_JSON)
@Tag(name = KeycloakOpenAPI.Admin.Tags.ORGANIZATIONS)
@Operation(summary = "Updates the organization")
@Operation(summary = "Updates the organization", operationId = "updateOrganization")
@APIResponses(value = {
@APIResponse(responseCode = "204", description = "No Content"),
@APIResponse(responseCode = "400", description = "Bad Request")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public OrganizationsResource(KeycloakSession session, AdminPermissionEvaluator a
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Tag(name = KeycloakOpenAPI.Admin.Tags.ORGANIZATIONS)
@Operation( summary = "Creates a new organization")
@Operation(summary = "Creates a new organization", operationId = "createOrganization")
@APIResponses(value = {
@APIResponse(responseCode = "201", description = "Created"),
@APIResponse(responseCode = "400", description = "Bad Request"),
Expand Down Expand Up @@ -137,7 +137,10 @@ public Response create(OrganizationRepresentation organization) {
@Produces(MediaType.APPLICATION_JSON)
@NoCache
@Tag(name = KeycloakOpenAPI.Admin.Tags.ORGANIZATIONS)
@Operation(summary = "Returns a paginated list of organizations filtered according to the specified parameters")
@Operation(
summary = "Returns a paginated list of organizations filtered according to the specified parameters",
operationId = "search"
)
@APIResponses(value = {
@APIResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = OrganizationRepresentation.class, type = SchemaType.ARRAY))),
@APIResponse(responseCode = "403", description = "Forbidden"),
Expand Down Expand Up @@ -196,7 +199,7 @@ public OrganizationResource get(@PathParam("org-id") String orgId) {
@Path("count")
@Produces(MediaType.APPLICATION_JSON)
@Tag(name = KeycloakOpenAPI.Admin.Tags.ORGANIZATIONS)
@Operation(summary = "Returns the organizations counts.")
@Operation(summary = "Returns the organizations counts.", operationId = "getOrganizationCount")
public long getOrganizationCount(
@Parameter(description = "A String representing either an organization name or domain") @QueryParam("search") String search,
@Parameter(description = "A query to search for custom attributes, in the format 'key1:value2 key2:value2'") @QueryParam("q") String searchQuery,
Expand All @@ -217,7 +220,10 @@ public long getOrganizationCount(
@Produces(MediaType.APPLICATION_JSON)
@NoCache
@Tag(name = KeycloakOpenAPI.Admin.Tags.ORGANIZATIONS)
@Operation(summary = "Returns the organizations associated with the user that has the specified id")
@Operation(
summary = "Returns the organizations associated with the user that has the specified id",
operationId = "getOrganizations"
)
@APIResponses(value = {
@APIResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = OrganizationRepresentation.class, type = SchemaType.ARRAY))),
@APIResponse(responseCode = "400", description = "Bad Request")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public AttackDetectionResource(KeycloakSession session, AdminPermissionEvaluator
@NoCache
@Produces(MediaType.APPLICATION_JSON)
@Tag(name = KeycloakOpenAPI.Admin.Tags.ATTACK_DETECTION)
@Operation( summary = "Get status of a username in brute force detection")
@Operation(summary = "Get status of a username in brute force detection", operationId = "bruteForceUserStatus")
public Map<String, Object> bruteForceUserStatus(@PathParam("userId") String userId) {
UserModel user = session.users().getUserById(realm, userId);
if (user == null) {
Expand Down Expand Up @@ -145,7 +145,10 @@ private boolean isUserDisabledOrLockedByBruteForce(KeycloakSession session, Real
@Path("brute-force/users/{userId}")
@DELETE
@Tag(name = KeycloakOpenAPI.Admin.Tags.ATTACK_DETECTION)
@Operation( summary="Clear any user login failures for the user This can release temporary disabled user")
@Operation(
summary = "Clear any user login failures for the user This can release temporary disabled user",
operationId = "clearBruteForceForUser"
)
public void clearBruteForceForUser(@PathParam("userId") String userId) {
UserModel user = session.users().getUserById(realm, userId);
if (user == null) {
Expand All @@ -169,7 +172,10 @@ public void clearBruteForceForUser(@PathParam("userId") String userId) {
@Path("brute-force/users")
@DELETE
@Tag(name = KeycloakOpenAPI.Admin.Tags.ATTACK_DETECTION)
@Operation( summary = "Clear any user login failures for all users This can release temporary disabled users")
@Operation(
summary = "Clear any user login failures for all users This can release temporary disabled users",
operationId = "clearAllBruteForce"
)
public void clearAllBruteForce() {
auth.users().requireManage();

Expand Down
Loading
0