Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2015 Zalando SE Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 package org.zalando.stups.tokens;
 import  org.springframework.beans.factory.DisposableBean;
 import  org.springframework.boot.context.embedded.EmbeddedServletContainerInitializedEvent;
 import  org.springframework.context.ApplicationListener;

 public class AccessTokensBean implements DisposableBean, AccessTokens,
     ApplicationListener<EmbeddedServletContainerInitializedEvent> {
     private final Logger logger = LoggerFactory.getLogger(AccessTokensBean.class);
     public AccessTokensBean(final AccessTokensBeanProperties accessTokensBeanProperties) {
         this. = accessTokensBeanProperties;
     public String get(final Object tokenIdthrows AccessTokenUnavailableException {
         return .get(tokenId);
     public AccessToken getAccessToken(final Object tokenIdthrows AccessTokenUnavailableException {
         return .getAccessToken(tokenId);
     public void invalidate(final Object tokenId) {
     public void stop() {
             "There is no need to stop the 'AccessTokenRefresher' before the container stops. This call does nothing. Sorry.");
     public void destroy() throws Exception {
         .info("Stop 'accessTokenRefresher' ...");
         .info("'accessTokenRefresher' stopped.");
     protected File getCredentialsFile(final String credentialsFilename) {
         return new File(.getCredentialsDirectory(), credentialsFilename);
     public void onApplicationEvent(final EmbeddedServletContainerInitializedEvent event) {
         .info("Container seems up an running");
        // TODO, if something fails here, shall we shutdown the container?
            .info("configure scopes for service {}"tc.getTokenId());
            AccessTokenConfiguration configuration = builder.manageToken(tc.getTokenId());
            configuration.addScopes(new HashSet<Object>(tc.getScopes()));
        .info("Start 'accessTokenRefresher' ...");
         = builder.start();
        .info("'accessTokenRefresher' started.");
New to GrepCode? Check out our FAQ X