aiden0z / guacamole-auth-jwt

Guacamole authentication extension based on JWT.
MIT License
35 stars 9 forks source link

guacamole properties #5

Closed christopherthant closed 4 years ago

christopherthant commented 6 years ago

hi, I updated guacamole.properties file as below and dropped the "guacamole-auth-jwt.1.0.0.jar" under "extensions" folder. Is there anything else I need configure.

guacd-hostname:localhost guacd-port:4822 auth-provider:com.aiden0z.guacamole.net.jwt.JwtAuthenticationProvider secret-key:1234567890

I'm receiving the error message when calling /api/token (gucamole url). I setup the guacamole according to this link https://www.tecmint.com/guacamole-access-remote-linux-windows-machines-via-web-browser I used 9.9 version. `

HTTP Status 500 - org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of VALUE_STRING token

    <HR size="1" noshade="noshade">
    <p>
        <b>type</b> Exception report
    </p>
    <p>
        <b>message</b>
        <u>org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of VALUE_STRING token</u>
    </p>
    <p>
        <b>description</b>
        <u>The server encountered an internal error that prevented it from fulfilling this request.</u>
    </p>
    <p>
        <b>exception</b>
        <pre>javax.servlet.ServletException: org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of VALUE_STRING token

at [Source: org.apache.catalina.connector.CoyoteInputStream@3c739a50; line: 2, column: 2] com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:420) com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538) com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716) javax.servlet.http.HttpServlet.service(HttpServlet.java:731) com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263) com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178) com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91) com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62) com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118) com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)

root cause

org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of VALUE_STRING token
 at [Source: org.apache.catalina.connector.CoyoteInputStream@3c739a50; line: 2, column: 2]
    org.codehaus.jackson.map.JsonMappingException.from(JsonMappingException.java:163)
    org.codehaus.jackson.map.deser.StdDeserializationContext.mappingException(StdDeserializationContext.java:219)
    org.codehaus.jackson.map.deser.StdDeserializationContext.mappingException(StdDeserializationContext.java:212)
    org.codehaus.jackson.map.deser.std.StringCollectionDeserializer.handleNonArray(StringCollectionDeserializer.java:210)
    org.codehaus.jackson.map.deser.std.StringCollectionDeserializer.deserialize(StringCollectionDeserializer.java:156)
    org.codehaus.jackson.map.deser.std.StringCollectionDeserializer.deserialize(StringCollectionDeserializer.java:146)
    org.codehaus.jackson.map.deser.std.StringCollectionDeserializer.deserialize(StringCollectionDeserializer.java:18)
    org.codehaus.jackson.map.deser.std.MapDeserializer._readAndBind(MapDeserializer.java:319)
    org.codehaus.jackson.map.deser.std.MapDeserializer.deserialize(MapDeserializer.java:249)
    org.codehaus.jackson.map.deser.std.MapDeserializer.deserialize(MapDeserializer.java:33)
    org.codehaus.jackson.map.ObjectMapper._readValue(ObjectMapper.java:2695)
    org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1308)
    org.codehaus.jackson.jaxrs.JacksonJsonProvider.readFrom(JacksonJsonProvider.java:419)
    com.sun.jersey.spi.container.ContainerRequest.getEntity(ContainerRequest.java:488)
    com.sun.jersey.spi.container.ContainerRequest.getEntity(ContainerRequest.java:552)
    com.sun.jersey.server.impl.model.method.dispatch.FormDispatchProvider.processForm(FormDispatchProvider.java:103)
    com.sun.jersey.server.impl.model.method.dispatch.FormDispatchProvider.access$000(FormDispatchProvider.java:68)
    com.sun.jersey.server.impl.model.method.dispatch.FormDispatchProvider$FormParameterProvider.getInjectableValues(FormDispatchProvider.java:115)
    com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$EntityParamInInvoker.getParams(AbstractResourceMethodDispatchProvider.java:153)
    com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:183)
    com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
    com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
    com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
    com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
    com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
    com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1511)
    com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442)
    com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
    com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
    com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
    com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
    com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263)
    com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178)
    com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91)
    com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62)
    com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)
    com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)`

I'm calling it from nodejs

`var  oPayload = {
      'GUAC_ID': 'connection_id',
      'guac.hostname': '90.xx.xx.xx',
      'guac.protocol': "rdp",
      'guac.port': '3389',
      'exp': newdate
    }
    console.log(oPayload);

    let url = process.env.GUACAMOLE_URL + 'api/tokens';  
    var jwtToken = jwts.encode(payload, '1234567890', 'HS512');

    request.post({
      url: url,
      data: {'token': jwtToken}
    },function (error, response, body) {
        console.log(body);
        return res.json({
          message: 'successfuly signed',
          token: jwtToken
        });
    });`

thanks in advance and thank you for making this component available to use. Your help is very much appreciated.            
aiden0z commented 6 years ago

You should use the latest guacamole version (currently 0.9.14).