svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.downloader / org.gvsig.downloader.lib / org.gvsig.downloader.lib.impl / src / main / java / org / gvsig / downloader / lib / impl / types / httpbasic / DownloaderHTTPBasicCredentials.java @ 47828
History | View | Annotate | Download (1.18 KB)
1 | 47821 | jjdelcerro | /*
|
---|---|---|---|
2 | * To change this license header, choose License Headers in Project Properties.
|
||
3 | * To change this template file, choose Tools | Templates
|
||
4 | * and open the template in the editor.
|
||
5 | */
|
||
6 | package org.gvsig.downloader.lib.impl.types.httpbasic; |
||
7 | |||
8 | 47824 | fdiaz | import java.nio.charset.StandardCharsets; |
9 | import java.util.Base64; |
||
10 | 47821 | jjdelcerro | import static org.gvsig.downloader.lib.impl.types.httpbasic.DownloaderHTTPBasicAuthenticationFactory.HTTPBASIC_AUTHENTICATION_NAME; |
11 | import org.gvsig.downloader.spi.AbstractDownloaderCredentials; |
||
12 | |||
13 | /**
|
||
14 | *
|
||
15 | * @author jjdelcerro
|
||
16 | */
|
||
17 | public class DownloaderHTTPBasicCredentials |
||
18 | extends
|
||
19 | AbstractDownloaderCredentials |
||
20 | { |
||
21 | |||
22 | private final String userid; |
||
23 | private final String password; |
||
24 | |||
25 | 47828 | jjdelcerro | public DownloaderHTTPBasicCredentials(String serviceUrl, String userid, String password) { |
26 | super(HTTPBASIC_AUTHENTICATION_NAME, serviceUrl);
|
||
27 | 47821 | jjdelcerro | this.userid = userid;
|
28 | this.password = password;
|
||
29 | } |
||
30 | |||
31 | @Override
|
||
32 | public String getAuthorizationToken() { |
||
33 | 47824 | fdiaz | return "Basic "+Base64.getEncoder().encodeToString((this.userid+":"+this.password).getBytes(StandardCharsets.UTF_8)); |
34 | 47821 | jjdelcerro | } |
35 | |||
36 | @Override
|
||
37 | public String getUserid() { |
||
38 | return this.userid; |
||
39 | } |
||
40 | |||
41 | } |