-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TSPS-191 add b2c authentication #106
Merged
Merged
Changes from 16 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
6d5b0f7
wip
mmorgantaylor f0e7e07
still wip
mmorgantaylor f49105b
remove additional path at end of oidc metadata endpoint
mmorgantaylor 79f47b2
spotless f
mmorgantaylor 30d15d5
what the fuck
mmorgantaylor 09c3481
attempt with oauth2
mmorgantaylor 650e0c0
hot damn it's working
mmorgantaylor e3e3efb
Merge branch 'main' into TSPS-191_mma_b2c_authn
mmorgantaylor b624b44
remove swagger controller, fix test
mmorgantaylor abe8a2a
wip tests
mmorgantaylor 3c4a1d2
tests work now
mmorgantaylor 9e645b5
add test for secondary template resolver
mmorgantaylor 94d805d
refactor secondary template resolver to its own class
mmorgantaylor 9016bd0
clean up PublicApiControllerTest
mmorgantaylor 60496c3
spotlessApply being weird
mmorgantaylor 5395884
don't optimize imports on the fly, intellij
mmorgantaylor 3cd0abf
refactor template resolver to components dir
mmorgantaylor 2c9a91d
spotless apply
mmorgantaylor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
service/src/main/java/bio/terra/pipelines/app/configuration/internal/OidcConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package bio.terra.pipelines.app.configuration.internal; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
|
||
@ConfigurationProperties("oidc") | ||
public record OidcConfiguration(String clientId, String authorityEndpoint, String tokenEndpoint) {} |
29 changes: 29 additions & 0 deletions
29
service/src/main/java/bio/terra/pipelines/app/configuration/internal/TemplateResolvers.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package bio.terra.pipelines.app.configuration.internal; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.stereotype.Component; | ||
import org.thymeleaf.templatemode.TemplateMode; | ||
import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver; | ||
|
||
@Component | ||
public class TemplateResolvers { | ||
|
||
/** | ||
* This bean is used to resolve the location of the Thymeleaf templates that are used to generate | ||
* the OpenAPI documentation, i.e. static/openapi.yml as referenced in templates/index.html. On | ||
* the other hand, the default resolver is used to resolve the location of the Swagger UI | ||
* index.html file in templates/. | ||
*/ | ||
@Bean | ||
public ClassLoaderTemplateResolver secondaryTemplateResolver() { | ||
ClassLoaderTemplateResolver secondaryTemplateResolver = new ClassLoaderTemplateResolver(); | ||
secondaryTemplateResolver.setPrefix("static/"); | ||
secondaryTemplateResolver.setSuffix(".yml"); | ||
secondaryTemplateResolver.setTemplateMode(TemplateMode.TEXT); | ||
secondaryTemplateResolver.setCharacterEncoding("UTF-8"); | ||
secondaryTemplateResolver.setOrder(1); | ||
secondaryTemplateResolver.setCheckExistence(true); | ||
|
||
return secondaryTemplateResolver; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 0 additions & 36 deletions
36
service/src/main/java/bio/terra/pipelines/app/controller/SwaggerController.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
service/src/test/java/bio/terra/pipelines/configuration/internal/OidcConfigurationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package bio.terra.pipelines.configuration.internal; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import bio.terra.pipelines.app.configuration.internal.OidcConfiguration; | ||
import bio.terra.pipelines.testutils.BaseEmbeddedDbTest; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
class OidcConfigurationTest extends BaseEmbeddedDbTest { | ||
|
||
@Autowired private OidcConfiguration oidcConfiguration; | ||
|
||
@Test | ||
void testOidcConfiguration() { | ||
assertEquals("test_client_id", oidcConfiguration.clientId()); | ||
assertEquals("test_authority_endpoint", oidcConfiguration.authorityEndpoint()); | ||
assertEquals("test_token_endpoint", oidcConfiguration.tokenEndpoint()); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
service/src/test/java/bio/terra/pipelines/configuration/internal/TemplateResolversTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package bio.terra.pipelines.configuration.internal; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import bio.terra.pipelines.app.configuration.internal.TemplateResolvers; | ||
import bio.terra.pipelines.testutils.BaseEmbeddedDbTest; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.thymeleaf.templatemode.TemplateMode; | ||
import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver; | ||
|
||
class TemplateResolversTest extends BaseEmbeddedDbTest { | ||
|
||
@Autowired TemplateResolvers templateResolvers; | ||
|
||
@Test | ||
void secondaryTemplateResolver() { | ||
ClassLoaderTemplateResolver secondaryTemplateResolver = | ||
templateResolvers.secondaryTemplateResolver(); | ||
assertNotNull(secondaryTemplateResolver); | ||
assertEquals("static/", secondaryTemplateResolver.getPrefix()); | ||
assertEquals(".yml", secondaryTemplateResolver.getSuffix()); | ||
assertEquals(TemplateMode.TEXT, secondaryTemplateResolver.getTemplateMode()); | ||
assertEquals("UTF-8", secondaryTemplateResolver.getCharacterEncoding()); | ||
assertEquals(1, secondaryTemplateResolver.getOrder()); | ||
assertTrue(secondaryTemplateResolver.getCheckExistence()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 0 additions & 35 deletions
35
service/src/test/java/bio/terra/pipelines/controller/SwaggerControllerTest.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this to an
app/components/
directory