Skip to content
Snippets Groups Projects
Commit e79029ae authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Added configuration for RAP OIDC connection

parent bd4a06e6
No related branches found
No related tags found
No related merge requests found
package it.inaf.ia2.gms; package it.inaf.ia2.gms;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso;
import org.springframework.context.annotation.Bean;
import org.springframework.security.oauth2.provider.token.TokenStore;
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter;
import org.springframework.security.oauth2.provider.token.store.jwk.JwkTokenStore;
@SpringBootApplication @SpringBootApplication
@EnableOAuth2Sso
public class GmsApplication { public class GmsApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(GmsApplication.class, args); SpringApplication.run(GmsApplication.class, args);
} }
@Value("${security.oauth2.resource.jwk.key-set-uri}")
private String keySetUri;
@Bean
public TokenStore tokenStore() {
JwkTokenStore jwkTokenStore = new JwkTokenStore(keySetUri, accessTokenConverter());
return jwkTokenStore;
}
@Bean
public JwtAccessTokenConverter accessTokenConverter() {
JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
return converter;
}
} }
package it.inaf.ia2.gms;
import java.security.Principal;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class LoginController {
@GetMapping("/login")
public Principal start(Principal principal) {
return principal;
}
@GetMapping("/")
public Principal root(Principal principal) {
return principal;
}
}
server.port=8081
security.oauth2.client.client-id=gms
security.oauth2.client.client-secret=gms-secret
security.oauth2.client.access-token-uri=http://localhost/rap-ia2/auth/oauth2/token
security.oauth2.client.user-authorization-uri=http://localhost/rap-ia2/auth/oauth2/authorize
#security.oauth2.resource.token-info-uri=http://localhost/rap-ia2/auth/oauth2/check_token
security.oauth2.client.scope=email,profile
security.oauth2.resource.jwk.key-set-uri=http://localhost/rap-ia2/auth/oidc/jwks
logging.level.org.springframework.security=DEBUG
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment