43 lines
887 B
Java
43 lines
887 B
Java
package org.gcube.common.authorization.utils.secret;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
import org.gcube.common.authorization.library.provider.AccessTokenProvider;
|
|
|
|
/**
|
|
* @author Luca Frosini (ISTI - CNR)
|
|
*/
|
|
public class JWTSecret extends Secret {
|
|
|
|
public JWTSecret(String token) {
|
|
super(10, token);
|
|
}
|
|
|
|
@Override
|
|
public void set() throws Exception {
|
|
AccessTokenProvider.instance.set(token);
|
|
|
|
}
|
|
|
|
@Override
|
|
public String getContext() throws Exception {
|
|
// TODO Auto-generated method stub
|
|
return null;
|
|
}
|
|
|
|
@Override
|
|
public Map<String, String> getHTTPAuthorizationHeaders() {
|
|
Map<String, String> authorizationHeaders = new HashMap<>();
|
|
authorizationHeaders.put("Authorization", "Bearer " + token);
|
|
return authorizationHeaders;
|
|
}
|
|
|
|
@Override
|
|
public String getUsername() throws Exception {
|
|
// TODO Auto-generated method stub
|
|
return null;
|
|
}
|
|
|
|
}
|