All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zalando.nakadiproducer.StupsTokenComponent Maven / Gradle / Ivy

There is a newer version: 30.0.0-RC1
Show newest version
package org.zalando.nakadiproducer;

import java.net.URI;
import java.util.Collection;

import org.zalando.stups.tokens.AccessTokens;
import org.zalando.stups.tokens.Tokens;

class StupsTokenComponent implements AccessTokenProvider {

    private static final String TOKEN_ID = "nakadi";
    private AccessTokens accessTokens;

    public StupsTokenComponent(URI accessTokenUri, Collection accessTokenScopes) {
        accessTokens = Tokens.createAccessTokensWithUri(accessTokenUri)
                             .manageToken(TOKEN_ID)
                             .addScopesTypeSafe(accessTokenScopes)
                             .done()
                             .start();
    }

    public void stop() {
        accessTokens.stop();
    }

    @Override
    public String getAccessToken() {
        return accessTokens.get(TOKEN_ID);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy