forked from eclipse-kapua/kapua
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ exposing user claims (list of domain/available action pairs); names…
… pending Signed-off-by: dseurotech <davide.salvador@eurotech.com>
- Loading branch information
1 parent
9e83a3d
commit 94320d6
Showing
6 changed files
with
158 additions
and
16 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
.../resources/src/main/java/org/eclipse/kapua/app/api/resources/v1/resources/Aaaaaaaaaa.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2016, 2022 Eurotech and/or its affiliates and others | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Eurotech - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.kapua.app.api.resources.v1.resources; | ||
|
||
import java.util.Set; | ||
|
||
import javax.inject.Inject; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.PathParam; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.MediaType; | ||
|
||
import org.eclipse.kapua.KapuaException; | ||
import org.eclipse.kapua.app.api.core.model.ScopeId; | ||
import org.eclipse.kapua.app.api.core.resources.AbstractKapuaResource; | ||
import org.eclipse.kapua.service.KapuaService; | ||
import org.eclipse.kapua.service.authorization.AuthorizationService; | ||
|
||
@Path("{scopeId}/aaaaaaaaaa/claims") | ||
public class Aaaaaaaaaa extends AbstractKapuaResource { | ||
|
||
@Inject | ||
private AuthorizationService authorizationService; | ||
|
||
/** | ||
* Gets the list of user's claims in the scope. | ||
* | ||
* @param scopeId | ||
* The {@link ScopeId} in which to search results. | ||
* @return The list of all the available claims associated to the current selected scope (and user). | ||
* @throws KapuaException | ||
* Whenever something bad happens. See specific {@link KapuaService} exceptions. | ||
* @since 1.0.0 | ||
*/ | ||
@GET | ||
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) | ||
public Set<String> fetchClaims( | ||
@PathParam("scopeId") ScopeId scopeId | ||
) throws KapuaException { | ||
return authorizationService.fetchUserClaims(scopeId); | ||
} | ||
|
||
} |
39 changes: 39 additions & 0 deletions
39
rest-api/resources/src/main/resources/openapi/aaaaaaaaaa/aaaaaaaaaa-scopeId.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
openapi: 3.0.3 | ||
|
||
info: | ||
title: Eclipse Kapua REST API - Aaaaaaaaaa | ||
version: '1.0' | ||
contact: | ||
name: Eclipse Kapua Dev Team | ||
url: https://eclipse.org/kapua | ||
email: kapua-dev@eclipse.org | ||
license: | ||
name: Eclipse Public License 2.0 | ||
url: https://www.eclipse.org/legal/epl-2.0 | ||
|
||
paths: | ||
/{scopeId}/claims: | ||
get: | ||
tags: | ||
- Claims | ||
summary: Get all the Claims | ||
operationId: fetchUserClaims | ||
parameters: | ||
- $ref: '../openapi.yaml#/components/parameters/scopeId' | ||
responses: | ||
200: | ||
description: The list of User's claims in the Scope | ||
content: | ||
application/json: | ||
schema: | ||
type: array | ||
items: | ||
type: string | ||
400: | ||
$ref: '../openapi.yaml#/components/responses/illegalArgument' | ||
401: | ||
$ref: '../openapi.yaml#/components/responses/unauthenticated' | ||
403: | ||
$ref: '../openapi.yaml#/components/responses/subjectUnauthorized' | ||
500: | ||
$ref: '../openapi.yaml#/components/responses/kapuaError' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters