akraxx / gitlab-jira-integration

WebService which intercept hook events from gitlab and use JIRA REST api to interact with issues.
MIT License
76 stars 32 forks source link

Unrecognized Character - #30

Closed Caroline00fr closed 8 years ago

Caroline00fr commented 8 years ago

Hi

I've tried your nice product. And with my very first test, having set everything, when committing on GItlab, I get an error message, which tells me I have an unexpected character in my token (-). Is this behavior the expected one?

WARN [2016-03-01 10:00:00,912] [dw-19 - POST /hook?token=MiqsB3p-r5CdzTko-nMX] [f.m.c.a.GitLabAuthFilter] Error decoding credentials ! com.google.common.io.BaseEncoding$DecodingException: Unrecognized character: - ! at com.google.common.io.BaseEncoding$Alphabet.decode(BaseEncoding.java:503) ~[gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at com.google.common.io.BaseEncoding$StandardBaseEncoding$2.read(BaseEncoding.java:675) ~[gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at com.google.common.io.BaseEncoding.decodeChecked(BaseEncoding.java:245) ~[gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at com.google.common.io.BaseEncoding.decode(BaseEncoding.java:226) ~[gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! ... 55 common frames omitted ! Causing: java.lang.IllegalArgumentException: com.google.common.io.BaseEncoding$DecodingException: Unrecognized character: - ! at com.google.common.io.BaseEncoding.decode(BaseEncoding.java:228) ~[gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at fr.mmarie.core.auth.GitLabAuthFilter.filter(GitLabAuthFilter.java:30) ~[gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.glassfish.jersey.server.ContainerFilteringStage.apply(ContainerFilteringStage.java:132) [gitlab-jira-integration-application-0.5.0-RC1.jar:n ] ! at org.glassfish.jersey.server.ContainerFilteringStage.apply(ContainerFilteringStage.java:68) [gitlab-jira-integration-application-0.5.0-RC1.jar:na

! at org.glassfish.jersey.process.internal.Stages.process(Stages.java:197) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:301) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.glassfish.jersey.internal.Errors.process(Errors.java:315) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.glassfish.jersey.internal.Errors.process(Errors.java:297) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.glassfish.jersey.internal.Errors.process(Errors.java:267) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:292) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1139) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:460) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:386) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:334) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:221) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at io.dropwizard.jetty.NonblockingServletHolder.handle(NonblockingServletHolder.java:49) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.eclipse.jetty.servlets.UserAgentFilter.doFilter(UserAgentFilter.java:83) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.eclipse.jetty.servlets.GzipFilter.doFilter(GzipFilter.java:300) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at io.dropwizard.jetty.BiDiGzipFilter.doFilter(BiDiGzipFilter.java:132) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at io.dropwizard.servlets.ThreadNameFilter.doFilter(ThreadNameFilter.java:29) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at io.dropwizard.jersey.filter.AllowedMethodsFilter.handle(AllowedMethodsFilter.java:43) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at io.dropwizard.jersey.filter.AllowedMethodsFilter.doFilter(AllowedMethodsFilter.java:38) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:89) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:119) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at com.google.inject.servlet.GuiceFilter$1.call(GuiceFilter.java:133) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at com.google.inject.servlet.GuiceFilter$1.call(GuiceFilter.java:130) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at com.google.inject.servlet.GuiceFilter$Context.call(GuiceFilter.java:203) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:130) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at com.codahale.metrics.jetty9.InstrumentedHandler.handle(InstrumentedHandler.java:240) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at io.dropwizard.jetty.RoutingHandler.handle(RoutingHandler.java:51) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:95) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:159) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.eclipse.jetty.server.Server.handle(Server.java:499) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) [gitlab-jira-integration-application-0.5.0-RC1.jar:na] ! at java.lang.Thread.run(Unknown Source) [na:1.8.0_73] 10.129.19.18 - - [01/mars/2016:10:00:00 +0000] "POST /hook?token=MiqsB3p-r5CdzTko-nMX HTTP/1.1" 401 294 "-" "-" 180

Caroline

Caroline00fr commented 8 years ago

I suspect my token is not correct. when running '$curl http://machine/api/v3/session --data-urlencode 'login=caroline' --data-urlencode 'password=mypass', I get {"name":"CAro","username":"caroline","id":5,"state":"active","avatar_url":"http://machine/uploads/user/avatar/5/acs2.jpg","web_url":"http://machine/u/caroline","created_at":"2015-11-16T11:07:07.991-05:00","is_admin":true,"bio":"!!","skype":"","linkedin":"","twitter":"","website_url":"","email":"caro@me.com","theme_id":3,"color_scheme_id":5,"projects_limit":10,"current_sign_in_at":"2016-02-24T08:30:28.934-05:00","identities":[],"can_create_group":true,"can_create_project":true,"two_factor_enab led":false,"private_token":"MiqsB3p-r5CdzTko-nMX"} Thus I set password=mypass in my yml file, and private_token equals to the private token displayed above.

It is not correct?

akraxx commented 8 years ago

Hi,

You have this error because private_token is base 64 encoded, so it accept only [a-zA-Z0-9+/] (base64).

You can take a look at issue #29, I explained how to generate a private_token

You just need to generate it correctly and it should work!

Caroline00fr commented 8 years ago

Thanks a lot! I'm going to try this. Thanks for your help, I really appreciate :)

akraxx commented 8 years ago

No problem! Have fun :)