Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #52 from tiki/release/fix-auth-intg
Browse files Browse the repository at this point in the history
fix: auth integration
  • Loading branch information
mike-audi authored Apr 30, 2023
2 parents cd6b093 + 7a67353 commit 6b2d1ff
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ info:
license:
name: MIT
url: https://github.com/tiki/l0-registry/blob/main/LICENSE
version: 1.1.2
version: 1.1.3
servers:
- url: https://registry.l0.mytiki.com
paths:
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>com.mytiki</groupId>
<artifactId>l0_registry</artifactId>
<version>1.1.2</version>
<version>1.1.3</version>
<packaging>jar</packaging>

<name>L0 Registry</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package com.mytiki.l0_registry.features.latest.config;

import com.mytiki.l0_registry.l0.auth.L0AuthAOApp;
import com.mytiki.l0_registry.l0.auth.L0AuthAOOrg;
import com.mytiki.l0_registry.l0.auth.L0AuthAOToken;
import com.mytiki.l0_registry.l0.auth.L0AuthService;
Expand Down Expand Up @@ -39,8 +40,9 @@ public ConfigDO getBilling(String appId){
.properties("appId", appId)
.build();
if(found.get().getBillingId() == null){
L0AuthAOToken token = l0AuthService.getToken(List.of("internal:org"));
L0AuthAOOrg org = l0AuthService.getOrg(appId, token.getAccessToken());
L0AuthAOToken token = l0AuthService.getToken(List.of("auth:internal:read"));
L0AuthAOApp app = l0AuthService.getApp(appId, token.getAccessToken());
L0AuthAOOrg org = l0AuthService.getOrg(app.getOrgId(), token.getAccessToken());
ConfigDO update = found.get();
update.setBillingId(org.getBillingId());
return repository.save(update);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ public L0AuthService l0AuthService(
@Value("${com.mytiki.l0_registry.l0_auth.key.id}") String id,
@Value("${com.mytiki.l0_registry.l0_auth.key.secret}") String secret,
@Autowired RestTemplateBuilder builder){
return new L0AuthService(builder.rootUri(uri).build(),id,secret);
return new L0AuthService(builder.rootUri(uri).build(), id, secret);
}
}

0 comments on commit 6b2d1ff

Please sign in to comment.