• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

cameri / nostream / 27402978681

12 Jun 2026 08:02AM UTC coverage: 67.292% (+0.3%) from 66.977%
27402978681

Pull #641

github

web-flow
Merge 014b0c8a3 into 1295272c3
Pull Request #641: feat: add admin backend foundation (login, session, health)

1966 of 3283 branches covered (59.88%)

Branch coverage included in aggregate %.

177 of 216 new or added lines in 15 files covered. (81.94%)

4527 of 6366 relevant lines covered (71.11%)

21.5 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

64.71
/src/controllers/admin/get-session-controller.ts
1
import { Request, Response } from 'express'
2

3
import { IAdminAuthProvider } from '../../@types/admin'
4
import { IController } from '../../@types/controllers'
5
import { Settings } from '../../@types/settings'
6
import { IRateLimiter } from '../../@types/utils'
7
import { isAdminRateLimited } from '../../utils/admin-rate-limit'
2✔
8

9
export class GetAdminSessionController implements IController {
2✔
10
  public constructor(
11
    private readonly authProvider: IAdminAuthProvider,
2✔
12
    private readonly settings: () => Settings,
2✔
13
    private readonly rateLimiter: () => IRateLimiter,
2✔
14
  ) {}
15

16
  public async handleRequest(request: Request, response: Response): Promise<void> {
17
    const currentSettings = this.settings()
2✔
18

19
    if (await isAdminRateLimited(request, currentSettings, this.rateLimiter, 'admin')) {
2!
NEW
20
      response.status(429).setHeader('content-type', 'application/json').send(JSON.stringify({ error: 'Too many requests' }))
×
NEW
21
      return
×
22
    }
23

24
    if (!this.authProvider.isRequestAuthenticated(request)) {
2!
NEW
25
      response.status(401).setHeader('content-type', 'application/json').send(JSON.stringify({ error: 'Unauthorized' }))
×
NEW
26
      return
×
27
    }
28

29
    response.status(200).setHeader('content-type', 'application/json').send(
2✔
30
      JSON.stringify({
31
        authenticated: true,
32
        expiresAt: this.authProvider.getSessionExpiresAt(request),
33
      }),
34
    )
35
  }
36
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc