Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2declare(strict_types=1);
3/**
4 * Pop PHP Framework (https://www.popphp.org/)
5 *
6 * @link       https://github.com/popphp/popphp-framework
7 * @author     Nick Sagona, III <nick@popphp.org>
8 * @copyright  Copyright (c) 2009-2026 Nick Sagona, III
9 * @license    https://www.popphp.org/license     New BSD License
10 */
11
12/**
13 * @namespace
14 */
15namespace Pop\Storage\Adapter\Azure;
16
17use Pop\Http\Client\Request;
18
19/**
20 * Azure storage auth interface
21 *
22 * @category   Pop
23 * @package    Pop\Storage
24 * @author     Nick Sagona, III <nick@popphp.org>
25 * @copyright  Copyright (c) 2009-2026 Nick Sagona, III
26 * @license    https://www.popphp.org/license     New BSD License
27 * @version    3.0.0
28 */
29interface AuthInterface
30{
31
32    /**
33     * Set account name
34     *
35     * @param  string $accountName
36     * @return AuthInterface
37     */
38    public function setAccountName(string $accountName): AuthInterface;
39
40    /**
41     * Get account name
42     *
43     * @return ?string
44     */
45    public function getAccountName(): ?string;
46
47    /**
48     * Has account name
49     *
50     * @return bool
51     */
52    public function hasAccountName(): bool;
53
54    /**
55     * Set account key
56     *
57     * @param  string $accountKey
58     * @return AuthInterface
59     */
60    public function setAccountKey(string $accountKey): AuthInterface;
61
62    /**
63     * Get account key
64     *
65     * @return ?string
66     */
67    public function getAccountKey(): ?string;
68
69    /**
70     * Has account key
71     *
72     * @return bool
73     */
74    public function hasAccountKey(): bool;
75
76    /**
77     * Get account key
78     *
79     * @return string
80     */
81    public function getBaseUri(): string;
82
83    /**
84     * Returns authorization header to be included in the request.
85     *
86     * @param  array  $headers
87     * @param  string $url
88     * @param  array  $queryParams
89     * @param  string $httpMethod
90     * @return string
91     */
92    public function getAuthorizationHeader(array $headers, string $url, array $queryParams, string $httpMethod): string;
93
94    /**
95     * Adds authentication header to the request headers.
96     *
97     * @param  Request $request
98     * @return Request
99     */
100    public function signRequest(Request $request): Request;
101
102    /**
103     * Generate a service SAS token for a blob
104     *
105     * @param  string     $resourcePath  e.g. '/container/blob.txt'
106     * @param  int        $expiresInSeconds
107     * @param  string     $permissions   e.g. 'r' for read-only
108     * @param  ?\DateTime $expiresAt     explicit expiry, overriding $expiresInSeconds (mainly for tests)
109     * @return string
110     */
111    public function generateSasToken(
112        string $resourcePath, int $expiresInSeconds, string $permissions = 'r', ?\DateTime $expiresAt = null
113    ): string;
114
115}