当前位置: 首页>>代码示例>>Java>>正文


Java FileAuthStore类代码示例

本文整理汇总了Java中com.flickr4java.flickr.util.FileAuthStore的典型用法代码示例。如果您正苦于以下问题:Java FileAuthStore类的具体用法?Java FileAuthStore怎么用?Java FileAuthStore使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FileAuthStore类属于com.flickr4java.flickr.util包,在下文中一共展示了FileAuthStore类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: authorize

import com.flickr4java.flickr.util.FileAuthStore; //导入依赖的package包/类
public static Auth authorize(Flickr flickr, File authDirectory, String username) throws IOException, SAXException, FlickrException {
	AuthStore authStore = new FileAuthStore(authDirectory);
	Auth auth = authStore.retrieve(flickr.getPeopleInterface().findByUsername(username).getId());
	if (auth != null) {
		RequestContext.getRequestContext().setAuth(auth);
		return auth;
	}

	AuthInterface authInterface = flickr.getAuthInterface();
	Token accessToken = authInterface.getRequestToken();

	String url = authInterface.getAuthorizationUrl(accessToken, Permission.READ);
	System.out.println("Please visit the following URL to get your authorization token:");
	System.out.println();
	System.out.println(url);
	System.out.println();
	System.out.print("Enter your token: ");
	String tokenKey = new Scanner(System.in).nextLine();

	Token requestToken = authInterface.getAccessToken(accessToken, new Verifier(tokenKey));

	auth = authInterface.checkToken(requestToken);
	RequestContext.getRequestContext().setAuth(auth);
	authStore.store(auth);
	return auth;
}
 
开发者ID:masneyb,项目名称:flickrdownload,代码行数:27,代码来源:Authentication.java

示例2: Upload

import com.flickr4java.flickr.util.FileAuthStore; //导入依赖的package包/类
public Upload(File authsDir) throws FlickrException, IOException {
    Properties properties;
    InputStream in = null;
    try {
        in = Upload.class.getResourceAsStream("setup.properties");
        properties = new Properties();
        properties.load(in);
    } finally {
        IOUtilities.close(in);
    }

    flickr = new Flickr(properties.getProperty("apiKey"),
            properties.getProperty("secret"), new REST());
    this.nsid = properties.getProperty("nsid");

    if (authsDir != null) {
        this.authStore = new FileAuthStore(authsDir);
    }
}
 
开发者ID:entercritical,项目名称:SwanFlickrUploader,代码行数:20,代码来源:Upload.java

示例3: GUI

import com.flickr4java.flickr.util.FileAuthStore; //导入依赖的package包/类
public GUI() throws FlickrException {
	isRunning = false;
	sizes = new ImageSizes();
	flickr = new Flickr(FlickrConfig.API_KEY, FlickrConfig.SECRET_KEY, new REST());
	flickrAuth = new FileAuthStore(Settings.getAuthDirectory());

	initComponents();
	Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
	this.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2);
	updateComponents();
}
 
开发者ID:lutana-de,项目名称:easyflickrbackup,代码行数:12,代码来源:GUI.java


注:本文中的com.flickr4java.flickr.util.FileAuthStore类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。