Implement support for user consent #4
@ -3,8 +3,12 @@ package se.su.dsv.oauth2;
|
|||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Profile;
|
import org.springframework.context.annotation.Profile;
|
||||||
|
import org.springframework.jdbc.core.JdbcOperations;
|
||||||
import org.springframework.jdbc.core.simple.JdbcClient;
|
import org.springframework.jdbc.core.simple.JdbcClient;
|
||||||
|
import org.springframework.security.oauth2.server.authorization.JdbcOAuth2AuthorizationConsentService;
|
||||||
|
import org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationConsentService;
|
||||||
import org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationService;
|
import org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationService;
|
||||||
|
import org.springframework.security.oauth2.server.authorization.client.RegisteredClientRepository;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@Profile("!embedded")
|
@Profile("!embedded")
|
||||||
@ -18,4 +22,12 @@ public class PersistentConfiguration {
|
|||||||
public OAuth2AuthorizationService authorizationService(JdbcClient jdbcClient) {
|
public OAuth2AuthorizationService authorizationService(JdbcClient jdbcClient) {
|
||||||
return new SerializingJDBCOAuth2AuthorizationService(jdbcClient);
|
return new SerializingJDBCOAuth2AuthorizationService(jdbcClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public OAuth2AuthorizationConsentService authorizationConsentService(
|
||||||
|
JdbcOperations jdbcOperations,
|
||||||
|
RegisteredClientRepository registeredClientRepository)
|
||||||
|
{
|
||||||
|
return new JdbcOAuth2AuthorizationConsentService(jdbcOperations, registeredClientRepository);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
7
src/main/resources/db/migration/V6__user_consent.sql
Normal file
7
src/main/resources/db/migration/V6__user_consent.sql
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
CREATE TABLE oauth2_authorization_consent
|
||||||
|
(
|
||||||
|
registered_client_id varchar(100) NOT NULL,
|
||||||
|
principal_name varchar(200) NOT NULL,
|
||||||
|
authorities varchar(1000) NOT NULL,
|
||||||
|
PRIMARY KEY (registered_client_id, principal_name)
|
||||||
|
);
|
||||||
Loading…
x
Reference in New Issue
Block a user