We use proprietary and third party´s cookies to improve your experience and our services, identifying your Internet Browsing preferences on our website; develop analytic activities and display advertising based on your preferences. If you keep browsing, you accept its use. You can get more information on our Cookie Policy
Cookies Policy
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

SCIM API - Keyrock Fiware

I am using a fiware-idm image in a docker container (https://hub.docker.com/r/fiware/idm/) and I'm trying access the SCIM API. There is user "idm" (default user), he's provider and has all permissions. But when I try get all users:

private String getAccessToken() { HttpServletRequest httpServletRequest = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest(); HttpSession session = httpServletRequest.getSession(); String accessToken = (String) session.getAttribute("access_token"); return accessToken; }

public void getUsers() throws IOException { String accessToken = getAccessToken();

Client client = ClientBuilder.newClient();
Response response = client.target("http://192.168.99.100:5000/v3/projects")
  .request(MediaType.TEXT_PLAIN_TYPE)
  .header("X-Auth-token", accessToken)
  .get();

setResultUsersList("-- status: " + response.getStatus() + " <br>" 
        + "-- headers: " + response.getHeaders() + " <br>"
        + "-- body: " + response.readEntity(String.class) + " <br>"
        + "-- token: " + accessToken);

} I receive an error msg: {"error": {"message": "The request you have made requires authentication.", "code": 401, "title": "Unauthorized"}}

But the authentication works and get the user infos too:

public void authenticateUser() throws OAuthSystemException, IOException { HttpServletResponse httpServletResponse = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();

OAuthClientRequest codeRequest = OAuthClientRequest
        .authorizationLocation("http://192.168.99.100:8000/oauth2/authorize")
        .setParameter("response_type", "code")
        .setClientId(CLIENT_ID)
        .setRedirectURI("http://localhost:8080/Example-Application-Security-UI/auth")
        .buildQueryMessage();

httpServletResponse.sendRedirect(codeRequest.getLocationUri());

}

public void requestUserInfo() { HttpServletRequest httpServletRequest = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest(); HttpSession session = httpServletRequest.getSession(); accessToken = (String) session.getAttribute("access_token");

String strJson = callWebservice("http://192.168.99.100:8000/user?access_token=" + accessToken);
JSONObject jsonObject = new JSONObject(strJson);
resultUserInfo = jsonObject.toString();

}

SCIM API - Keyrock Fiware

I am using a fiware-idm image in a docker container (https://hub.docker.com/r/fiware/idm/) and I'm trying access the SCIM API. There is user "idm" (default user), he's provider and has all permissions. But when I try get all users:

private String getAccessToken() { HttpServletRequest httpServletRequest = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest(); HttpSession session = httpServletRequest.getSession(); String accessToken = (String) session.getAttribute("access_token"); return accessToken; }

public void getUsers() throws IOException { String accessToken = getAccessToken();

Client client = ClientBuilder.newClient();
Response response = client.target("http://192.168.99.100:5000/v3/projects")
  .request(MediaType.TEXT_PLAIN_TYPE)
  .header("X-Auth-token", accessToken)
  .get();

setResultUsersList("-- status: " + response.getStatus() + " <br>" 
        + "-- headers: " + response.getHeaders() + " <br>"
        + "-- body: " + response.readEntity(String.class) + " <br>"
        + "-- token: " + accessToken);

} I receive an error msg: {"error": {"message": "The request you have made requires authentication.", "code": 401, "title": "Unauthorized"}}

But the authentication works and get the user infos too:

public void authenticateUser() throws OAuthSystemException, IOException { HttpServletResponse httpServletResponse = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();

OAuthClientRequest codeRequest = OAuthClientRequest
        .authorizationLocation("http://192.168.99.100:8000/oauth2/authorize")
        .setParameter("response_type", "code")
        .setClientId(CLIENT_ID)
        .setRedirectURI("http://localhost:8080/Example-Application-Security-UI/auth")
        .buildQueryMessage();

httpServletResponse.sendRedirect(codeRequest.getLocationUri());

}

public void requestUserInfo() { HttpServletRequest httpServletRequest = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest(); HttpSession session = httpServletRequest.getSession(); accessToken = (String) session.getAttribute("access_token");

String strJson = callWebservice("http://192.168.99.100:8000/user?access_token=" + accessToken);
JSONObject jsonObject = new JSONObject(strJson);
resultUserInfo = jsonObject.toString();

}

SCIM API - Keyrock Fiware

I am using a fiware-idm image in a docker container (https://hub.docker.com/r/fiware/idm/) and I'm trying access the SCIM API. There is user "idm" (default user), he's provider and has all permissions. But when I try get all users:

private String getAccessToken() {
    HttpServletRequest httpServletRequest = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
    HttpSession session = httpServletRequest.getSession();
    String accessToken = (String) session.getAttribute("access_token");
    return accessToken;
 }

} public void getUsers() throws IOException { String accessToken = getAccessToken();

 Client client = ClientBuilder.newClient();
 Response response = client.target("http://192.168.99.100:5000/v3/projects")
   .request(MediaType.TEXT_PLAIN_TYPE)
   .header("X-Auth-token", accessToken)
   .get();

 setResultUsersList("-- status: " + response.getStatus() + " <br>" 
         + "-- headers: " + response.getHeaders() + " <br>"
         + "-- body: " + response.readEntity(String.class) + " <br>"
         + "-- token: " + accessToken);
}

} I receive an error msg: {"error": {"message": "The request you have made requires authentication.", "code": 401, "title": "Unauthorized"}}

But the authentication works and get the user infos too:

public void authenticateUser() throws OAuthSystemException, IOException {
    HttpServletResponse httpServletResponse = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();

 FacesContext.getCurrentInstance().getExternalContext().getResponse();


    OAuthClientRequest codeRequest = OAuthClientRequest
        .authorizationLocation("http://192.168.99.100:8000/oauth2/authorize")
        .setParameter("response_type", "code")
        .setClientId(CLIENT_ID)
        .setRedirectURI("http://localhost:8080/Example-Application-Security-UI/auth")
        .buildQueryMessage();
  httpServletResponse.sendRedirect(codeRequest.getLocationUri());

}

 public void requestUserInfo() {
     HttpServletRequest httpServletRequest = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
     HttpSession session = httpServletRequest.getSession();
     accessToken = (String) session.getAttribute("access_token");

session.getAttribute("access_token");

        String strJson = callWebservice("http://192.168.99.100:8000/user?access_token=" + accessToken);
 JSONObject jsonObject = new JSONObject(strJson);
 resultUserInfo = jsonObject.toString();
   }

}