6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'app/controllers/standard_id/provider/introspection_controller.rb', line 6
def create
token = params[:token]
if token.blank?
render json: { active: false }
return
end
payload = StandardId::JwtService.decode(token)
if payload.nil?
render json: { active: false }
return
end
if payload[:jti].present? && RevokedToken.revoked?(payload[:jti])
render json: { active: false }
return
end
render json: {
active: true,
sub: payload[:sub],
client_id: payload[:client_id],
scope: payload[:scope],
iss: payload[:iss],
exp: payload[:exp],
iat: payload[:iat],
jti: payload[:jti],
aud: payload[:aud],
token_type: "Bearer"
}.compact
end
|