|
18 | 18 | package subnet |
19 | 19 |
|
20 | 20 | import ( |
21 | | - "bytes" |
22 | 21 | "encoding/json" |
23 | 22 | "errors" |
24 | | - "fmt" |
25 | 23 |
|
26 | 24 | "github.com/minio/console/pkg/http" |
27 | 25 |
|
28 | | - "github.com/minio/pkg/v2/licverifier" |
29 | | - |
30 | 26 | "github.com/minio/console/models" |
31 | 27 | "github.com/minio/madmin-go/v3" |
32 | 28 | mc "github.com/minio/mc/cmd" |
@@ -124,46 +120,6 @@ func Register(client http.ClientI, admInfo madmin.InfoMessage, apiKey, token, ac |
124 | 120 | return nil, errors.New("subnet api key not found") |
125 | 121 | } |
126 | 122 |
|
127 | | -const publicKey = "/downloads/license-pubkey.pem" |
128 | | - |
129 | | -// downloadSubnetPublicKey will download the current subnet public key. |
130 | | -func downloadSubnetPublicKey(client http.ClientI) (string, error) { |
131 | | - // Get the public key directly from Subnet |
132 | | - url := fmt.Sprintf("%s%s", subnetBaseURL(), publicKey) |
133 | | - resp, err := client.Get(url) |
134 | | - if err != nil { |
135 | | - return "", err |
136 | | - } |
137 | | - defer resp.Body.Close() |
138 | | - buf := new(bytes.Buffer) |
139 | | - _, err = buf.ReadFrom(resp.Body) |
140 | | - if err != nil { |
141 | | - return "", err |
142 | | - } |
143 | | - return buf.String(), err |
144 | | -} |
145 | | - |
146 | | -// ParseLicense parses the license with the bundle public key and return it's information |
147 | | -func ParseLicense(client http.ClientI, license string) (*licverifier.LicenseInfo, error) { |
148 | | - var publicKeys []string |
149 | | - |
150 | | - subnetPubKey, err := downloadSubnetPublicKey(client) |
151 | | - if err != nil { |
152 | | - // there was an issue getting the subnet public key |
153 | | - // use hardcoded public keys instead |
154 | | - publicKeys = OfflinePublicKeys |
155 | | - } else { |
156 | | - publicKeys = append(publicKeys, subnetPubKey) |
157 | | - } |
158 | | - |
159 | | - licenseInfo, err := GetLicenseInfoFromJWT(license, publicKeys) |
160 | | - if err != nil { |
161 | | - return nil, err |
162 | | - } |
163 | | - |
164 | | - return licenseInfo, nil |
165 | | -} |
166 | | - |
167 | 123 | func GetAPIKey(client http.ClientI, token string) (string, error) { |
168 | 124 | resp, err := subnetGetReq(client, subnetAPIKeyURL(), subnetAuthHeaders(token)) |
169 | 125 | if err != nil { |
|
0 commit comments