Improving code
This commit is contained in:
parent
4af598dfa8
commit
ff7b79bb05
2
pom.xml
2
pom.xml
|
@ -27,7 +27,7 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>gcube-bom</artifactId>
|
||||
<version>2.1.0-SNAPSHOT</version>
|
||||
<version>2.0.1</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
|
|
@ -61,11 +61,6 @@ public class GCubeSecret extends Secret {
|
|||
return getAuthorizationEntry().getContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsername() throws Exception {
|
||||
return getClientInfo().getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getHTTPAuthorizationHeaders() {
|
||||
Map<String, String> authorizationHeaders = new HashMap<>();
|
||||
|
|
|
@ -80,14 +80,4 @@ public class JWTSecret extends Secret {
|
|||
return authorizationHeaders;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsername() throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.common.authorization.utils.secret;
|
|||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.gcube.common.authorization.library.ClientType;
|
||||
import org.gcube.common.authorization.library.exception.AuthorizationException;
|
||||
import org.gcube.common.authorization.library.provider.AuthorizationProvider;
|
||||
import org.gcube.common.authorization.library.provider.ClientInfo;
|
||||
|
@ -57,7 +58,13 @@ public abstract class Secret implements Comparable<Secret> {
|
|||
|
||||
public abstract String getContext() throws Exception;
|
||||
|
||||
public abstract String getUsername() throws Exception;
|
||||
public String getUsername() throws Exception {
|
||||
return getClientInfo().getId();
|
||||
}
|
||||
|
||||
public boolean isApplication() throws Exception {
|
||||
return getClientInfo().getType() == ClientType.EXTERNALSERVICE;
|
||||
}
|
||||
|
||||
public abstract Map<String,String> getHTTPAuthorizationHeaders();
|
||||
|
||||
|
|
Loading…
Reference in New Issue