Skip to main content
summaryrefslogtreecommitdiffstats
blob: 19cd580cd0450cdd4ca2585481c1c47c18dc697e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*******************************************************************************
 * Copyright (c) 2011 Red Hat and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     David Green <david.green@tasktop.com> - initial contribution
 *     Christian Trutz <christian.trutz@gmail.com> - initial contribution
 *     Chris Aniszczyk <caniszczyk@gmail.com> - initial contribution
 *******************************************************************************/
package org.eclipse.mylyn.github.internal;

import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
import org.eclipse.mylyn.commons.net.AuthenticationType;
import org.eclipse.mylyn.tasks.core.TaskRepository;

public class GitHubCredentials {
	private final String username;
	private final String apiToken;
	
	
	public GitHubCredentials(String username, String apiToken) {
		this.username = username;
		this.apiToken = apiToken;
	}
	
	public GitHubCredentials(AuthenticationCredentials credentials) {
		this(credentials.getUserName(),credentials.getPassword());
	}

	public static GitHubCredentials create(TaskRepository repository) {
		return new GitHubCredentials(repository.getCredentials(AuthenticationType.REPOSITORY));
	}
	
	public String getUsername() {
		return username;
	}
	public String getApiToken() {
		return apiToken;
	}
	
}

Back to the top