apache / pulsar-manager

Apache Pulsar Manager
https://pulsar.apache.org/
Apache License 2.0
521 stars 246 forks source link

pulsar-manager generate token report error: Token generate failed #311

Open lvs071103 opened 4 years ago

lvs071103 commented 4 years ago

env: image error: image

logs:

2020-06-26 06:17:37.746 DEBUG 47 --- [http-nio-7750-Acceptor-0] o.apache.tomcat.util.threads.LimitLatch  : Counting up[http-nio-7750-Acceptor-0] latch=1
2020-06-26 06:17:37.746 DEBUG 47 --- [http-nio-7750-exec-2] o.a.tomcat.util.net.SocketWrapperBase    : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@31e6a7be:org.apache.tomcat.util.net.NioChannel@65bf90c4:java.nio.channels.SocketChannel[connected local=/127.0.0.1:7750 remote=/127.0.0.1:47070]], Read from buffer: [0]
2020-06-26 06:17:37.746 DEBUG 47 --- [http-nio-7750-exec-2] org.apache.tomcat.util.net.NioEndpoint   : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@31e6a7be:org.apache.tomcat.util.net.NioChannel@65bf90c4:java.nio.channels.SocketChannel[connected local=/127.0.0.1:7750 remote=/127.0.0.1:47070]], Read direct from socket: [1148]
2020-06-26 06:17:37.747 DEBUG 47 --- [http-nio-7750-exec-2] o.a.coyote.http11.Http11InputBuffer      : Received [PUT /pulsar-manager/tokens/token HTTP/1.0
Host: localhost:7750
Connection: close
Content-Length: 53
Accept: application/json, text/plain, */*
environment: pulsar-clusters
username: pulsar
token: eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJwdWxzYXJlMDA4MTFiYjUzNjMwZTNiYjY1YTU1MzgwZTdiYjZjNDI3YjhlZjg5NTAxNTkxNWQ3NzExYTlmYjljOTM2NjBhMTU5MzE1MDQwOTAzOCIsImV4cCI6MTU5MTQ0NzQ0MX0.z9-sa2NK0g8PDY0jUx07SxiraJkKkTcJzjeyZmFOzm8
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36
tenant: pulsar
Content-Type: application/json
Origin: http://10.1.104.130:9527
Referer: http://10.1.104.130:9527/
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Cookie: language=zh; JSESSIONID=89297C71E70241A89CD8E1D03CD9EDB3; Admin-Token=eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJwdWxzYXJlMDA4MTFiYjUzNjMwZTNiYjY1YTU1MzgwZTdiYjZjNDI3YjhlZjg5NTAxNTkxNWQ3NzExYTlmYjljOTM2NjBhMTU5MzE1MDQwOTAzOCIsImV4cCI6MTU5MTQ0NzQ0MX0.z9-sa2NK0g8PDY0jUx07SxiraJkKkTcJzjeyZmFOzm8; username=pulsar; tenant=pulsar; Admin-Environment=pulsar-clusters

{"role":"zhoufurong","token":"","description":"test"}]
2020-06-26 06:17:37.748 DEBUG 47 --- [http-nio-7750-exec-2] o.a.t.util.http.Rfc6265CookieProcessor   : Cookies: Parsing b[]: language=zh; JSESSIONID=89297C71E70241A89CD8E1D03CD9EDB3; Admin-Token=eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJwdWxzYXJlMDA4MTFiYjUzNjMwZTNiYjY1YTU1MzgwZTdiYjZjNDI3YjhlZjg5NTAxNTkxNWQ3NzExYTlmYjljOTM2NjBhMTU5MzE1MDQwOTAzOCIsImV4cCI6MTU5MTQ0NzQ0MX0.z9-sa2NK0g8PDY0jUx07SxiraJkKkTcJzjeyZmFOzm8; username=pulsar; tenant=pulsar; Admin-Environment=pulsar-clusters
2020-06-26 06:17:37.748 DEBUG 47 --- [http-nio-7750-exec-2] o.a.catalina.connector.CoyoteAdapter     :  Requested cookie session id is 89297C71E70241A89CD8E1D03CD9EDB3
2020-06-26 06:17:37.748 DEBUG 47 --- [http-nio-7750-exec-2] o.a.c.authenticator.AuthenticatorBase    : Security checking request PUT /pulsar-manager/tokens/token
2020-06-26 06:17:37.748 DEBUG 47 --- [http-nio-7750-exec-2] org.apache.catalina.realm.RealmBase      :   No applicable constraints defined
2020-06-26 06:17:37.748 DEBUG 47 --- [http-nio-7750-exec-2] o.a.c.authenticator.AuthenticatorBase    :  Not subject to any constraint
2020-06-26 06:17:37.751 DEBUG 47 --- [http-nio-7750-exec-2] o.a.p.m.m.UsersMapper.findByAccessToken  : ==>  Preparing: SELECT access_token AS accessToken, user_id AS userId, name, description, email,phone_number AS phoneNumber, location, company, expire FROM users WHERE access_token = ?
2020-06-26 06:17:37.751 DEBUG 47 --- [http-nio-7750-exec-2] o.a.p.m.m.UsersMapper.findByAccessToken  : ==> Parameters: eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJwdWxzYXJlMDA4MTFiYjUzNjMwZTNiYjY1YTU1MzgwZTdiYjZjNDI3YjhlZjg5NTAxNTkxNWQ3NzExYTlmYjljOTM2NjBhMTU5MzE1MDQwOTAzOCIsImV4cCI6MTU5MTQ0NzQ0MX0.z9-sa2NK0g8PDY0jUx07SxiraJkKkTcJzjeyZmFOzm8(String)
2020-06-26 06:17:37.752 DEBUG 47 --- [http-nio-7750-exec-2] o.a.p.m.m.UsersMapper.findByAccessToken  : <==      Total: 1
2020-06-26 06:17:37.752 DEBUG 47 --- [http-nio-7750-exec-2] o.a.p.m.m.EnvironmentsMapper.findByName  : ==>  Preparing: SELECT name,broker FROM environments where name=?
2020-06-26 06:17:37.752 DEBUG 47 --- [http-nio-7750-exec-2] o.a.p.m.m.EnvironmentsMapper.findByName  : ==> Parameters: pulsar-clusters(String)
2020-06-26 06:17:37.753 DEBUG 47 --- [http-nio-7750-exec-2] o.a.p.m.m.EnvironmentsMapper.findByName  : <==      Total: 1
2020-06-26 06:17:37.753 DEBUG 47 --- [http-nio-7750-exec-2] o.a.p.m.m.UsersMapper.findByAccessToken  : ==>  Preparing: SELECT access_token AS accessToken, user_id AS userId, name, description, email,phone_number AS phoneNumber, location, company, expire FROM users WHERE access_token = ?
2020-06-26 06:17:37.753 DEBUG 47 --- [http-nio-7750-exec-2] o.a.p.m.m.UsersMapper.findByAccessToken  : ==> Parameters: eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJwdWxzYXJlMDA4MTFiYjUzNjMwZTNiYjY1YTU1MzgwZTdiYjZjNDI3YjhlZjg5NTAxNTkxNWQ3NzExYTlmYjljOTM2NjBhMTU5MzE1MDQwOTAzOCIsImV4cCI6MTU5MTQ0NzQ0MX0.z9-sa2NK0g8PDY0jUx07SxiraJkKkTcJzjeyZmFOzm8(String)
2020-06-26 06:17:37.753 DEBUG 47 --- [http-nio-7750-exec-2] o.a.p.m.m.UsersMapper.findByAccessToken  : <==      Total: 1
2020-06-26 06:17:37.754 DEBUG 47 --- [http-nio-7750-exec-2] o.a.p.m.m.R.findAllByUserId              : ==>  Preparing: SELECT name, role_binding_id as roleBindingId, description, user_id as userId, role_id as roleId FROM role_binding WHERE user_id = ?
2020-06-26 06:17:37.754 DEBUG 47 --- [http-nio-7750-exec-2] o.a.p.m.m.R.findAllByUserId              : ==> Parameters: 1(Long)
2020-06-26 06:17:37.754 DEBUG 47 --- [http-nio-7750-exec-2] o.a.p.m.m.R.findAllByUserId              : <==      Total: 1
2020-06-26 06:17:37.755 DEBUG 47 --- [http-nio-7750-exec-2] o.a.p.m.m.RolesMapper.findAllByMultiId   : ==>  Preparing: SELECT role_name AS roleName, role_id AS roleId, description, resource_type AS resourceType,resource_name AS resourceName, resource_verbs AS resourceVerbs, resource_id as resourceId,role_source AS roleSource, flag FROM roles WHERE role_id IN ( ? )
2020-06-26 06:17:37.755 DEBUG 47 --- [http-nio-7750-exec-2] o.a.p.m.m.RolesMapper.findAllByMultiId   : ==> Parameters: 1(Long)
2020-06-26 06:17:37.756 DEBUG 47 --- [http-nio-7750-exec-2] o.a.p.m.m.RolesMapper.findAllByMultiId   : <==      Total: 1
2020-06-26 06:17:37.757 DEBUG 47 --- [http-nio-7750-exec-2] o.a.p.m.m.B.findTokenByRole              : ==>  Preparing: select token_id as tokenId, role, description, token FROM tokens where role=?
2020-06-26 06:17:37.757 DEBUG 47 --- [http-nio-7750-exec-2] o.a.p.m.m.B.findTokenByRole              : ==> Parameters: zhoufurong(String)
2020-06-26 06:17:37.758 DEBUG 47 --- [http-nio-7750-exec-2] o.a.p.m.m.B.findTokenByRole              : <==      Total: 0
2020-06-26 06:17:37.758  INFO 47 --- [http-nio-7750-exec-2] o.a.p.m.service.impl.JwtServiceImpl      : Default disable JWT auth, please set jwt.broker.token.mode.
2020-06-26 06:17:37.759 DEBUG 47 --- [http-nio-7750-exec-2] o.apache.coyote.http11.Http11Processor   : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@31e6a7be:org.apache.tomcat.util.net.NioChannel@65bf90c4:java.nio.channels.SocketChannel[connected local=/127.0.0.1:7750 remote=/127.0.0.1:47070]], Status in: [OPEN_READ], State out: [CLOSED]
2020-06-26 06:17:37.760 DEBUG 47 --- [http-nio-7750-exec-2] o.apache.tomcat.util.threads.LimitLatch  : Counting down[http-nio-7750-exec-2] latch=1
2020-06-26 06:17:37.760 DEBUG 47 --- [http-nio-7750-exec-2] org.apache.tomcat.util.net.NioEndpoint   : Socket: [org.apache.tomcat.util.net.NioChannel@65bf90c4:java.nio.channels.SocketChannel[closed]] closed
sijie commented 4 years ago

@lvs071103 did @tuteng already help you on the wechat group?

pisceslj commented 3 years ago

The token is generated from the broker JWT private key as follows,maybe you should config these parameters: jwt.broker.token.mode=PRIVATE jwt.broker.public.key=file:///path/pulsar/broker-public.key jwt.broker.private.key=file:///path/broker-private.key

or

jwt.broker.token.mode=SECRET jwt.broker.secret.key=file:///path/broker-secret.key