This commit is contained in:
2024-11-02 20:38:12 +01:00
parent adea956b48
commit 59bd5f6b78
4 changed files with 34 additions and 9 deletions
@@ -5,9 +5,12 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.oauth2.client.OAuth2AuthorizedClientManager;
import org.springframework.security.oauth2.client.OAuth2AuthorizedClientProviderBuilder;
import org.springframework.security.oauth2.client.registration.ClientRegistration;
import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository;
import org.springframework.security.oauth2.client.registration.InMemoryClientRegistrationRepository;
import org.springframework.security.oauth2.client.web.DefaultOAuth2AuthorizedClientManager;
import org.springframework.security.oauth2.client.web.OAuth2AuthorizedClientRepository;
import org.springframework.security.oauth2.core.AuthorizationGrantType;
@Configuration
public class OAuth2Configuration {
@@ -32,4 +35,27 @@ public class OAuth2Configuration {
return authorizedClientManager;
}
// @Bean
// public ClientRegistrationRepository clientRegistrationRepository() {
// return new InMemoryClientRegistrationRepository(auth0ClientRegistration());
// }
//
// private ClientRegistration auth0ClientRegistration() {
// String baseURL = "dev-tooc5a5nck2ypxpw.us.auth0.com";
//
//
// return ClientRegistration.withRegistrationId("auth0")
// .clientId("42r6XuNTM1jRB9M2LLTjoyap4HBmXByO")
// .clientSecret("F-AAsTTSOKx8bkPRrM4vCaMdv-hyLI6yjWcJE7Kh-Y2QKLcqssn0mmKk-6TQGezy")
// .redirectUri("http://localhost:8080/login/oauth2/code/auth0")
// .authorizationUri("https://dev-tooc5a5nck2ypxpw.us.auth0.com/authorize")
// .tokenUri("https://dev-tooc5a5nck2ypxpw.us.auth0.com/oauth/token")
// .userInfoUri("https://dev-tooc5a5nck2ypxpw.us.auth0.com/userinfo")
// .userNameAttributeName("sub")
// .jwkSetUri("https://dev-tooc5a5nck2ypxpw.us.auth0.com/.well-known/jwks.json")
// .clientName("Auth0")
// .authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE)
// .scope("openid", "profile", "email")
// .build();
// }
}
+6 -8
View File
@@ -148,12 +148,13 @@ spring:
client:
provider:
oidc:
issuer-uri: http://localhost:9080/realms/jhipster
# make sure to include the ending slash!
issuer-uri: https://dev-tooc5a5nck2ypxpw.us.auth0.com/
registration:
oidc:
client-id: web_app
client-secret: web_app
scope: openid, profile, email, offline_access # last one for refresh tokens
client-id: 42r6XuNTM1jRB9M2LLTjoyap4HBmXByO
client-secret: F-AAsTTSOKx8bkPRrM4vCaMdv-hyLI6yjWcJE7Kh-Y2QKLcqssn0mmKk-6TQGezy
scope: openid,profile,email
task:
execution:
thread-name-prefix: sasiedzi-task-
@@ -217,11 +218,8 @@ jhipster:
license: unlicensed
license-url:
security:
content-security-policy: "default-src 'self'; frame-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://storage.googleapis.com; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:"
oauth2:
audience:
- account
- api://default
audience: https://dev-tooc5a5nck2ypxpw.us.auth0.com/api/v2/
# ===================================================================
# Application specific properties
# Add your own application properties here, see the ApplicationProperties class
+1
View File
@@ -29,6 +29,7 @@
<logger name="com.sasiedzi.event" level="INFO"/>
<logger name="javax.management" level="WARN"/>
<logger name="angus.activation" level="WARN"/>
<logger name="jakarta.activation" level="WARN"/>
<logger name="jakarta.mail" level="WARN"/>