Skip to content

Commit a0dfb45

Browse files
committed
add refresh button
1 parent cf6d806 commit a0dfb45

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

spring-security-oauth-server/src/main/java/org/baeldung/config/OAuth2AuthorizationServerConfig.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void configure(final ClientDetailsServiceConfigurer clients) throws Excep
5959
.secret("secret")
6060
.authorizedGrantTypes("password","authorization_code", "refresh_token")
6161
.scopes("foo","read","write")
62-
.accessTokenValiditySeconds(3600) // 1 hour
62+
.accessTokenValiditySeconds(15) // 1 hour
6363
.refreshTokenValiditySeconds(2592000) // 30 days
6464

6565
.and()

spring-security-oauth-ui-password/src/main/resources/templates/header.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,12 @@
4646

4747
$scope.login = function() {
4848
obtainAccessToken($scope.loginData);
49-
}
49+
}
5050

5151

52+
$scope.refreshAccessToken = function(){
53+
obtainAccessToken($scope.refreshData);
54+
}
5255

5356
function obtainAccessToken(params){
5457
var req = {

spring-security-oauth-ui-password/src/main/resources/templates/index.html

+5
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ <h1 class="col-sm-12">Foo Details</h1>
2525
<a class="btn btn-default" href="#" ng-click="getFoo()">New Foo</a>
2626
</div>
2727

28+
<div class="col-sm-12">
29+
<br/>
30+
<br/>
31+
<a class="btn btn-info" href="#" ng-click="refreshAccessToken()">Refresh Access Token</a>
32+
</div>
2833
</div>
2934
</body>
3035
</html>

0 commit comments

Comments
 (0)