Revision 47845 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.downloader/org.gvsig.downloader.swing/org.gvsig.downloader.swing.scribejava/src/main/java/org/gvsig/downloader/swing/scribejava/keycloak/DownloaderAuthenticationKeycloakConfig.java
DownloaderAuthenticationKeycloakConfig.java | ||
---|---|---|
141 | 141 |
} |
142 | 142 |
|
143 | 143 |
@Override |
144 |
public boolean isFilled() { |
|
145 |
return StringUtils.isNotBlank(this.clientid) && |
|
146 |
StringUtils.isNotBlank(this.scope) && |
|
147 |
this.localPort >= 1024 && |
|
148 |
StringUtils.isNotBlank(this.realm) && |
|
149 |
StringUtils.isNotBlank(this.keycloakBaseurl); |
|
150 |
} |
|
151 |
|
|
152 |
@Override |
|
144 | 153 |
public boolean requestAuthenticationConfig() { |
145 | 154 |
WindowManager_v2 winmgr = (WindowManager_v2) ToolsSwingLocator.getWindowManager(); |
146 | 155 |
DownloaderAuthenticationKeycloakConfigPanel panel = new DownloaderAuthenticationKeycloakConfigPanel(); |
... | ... | |
263 | 272 |
} |
264 | 273 |
|
265 | 274 |
@Override |
266 |
public DownloaderCredentials getCredentials(DownloaderCredentials credentials) {
|
|
267 |
if(!(credentials instanceof DownloaderKeycloakCredentials)){
|
|
275 |
public DownloaderAuthenticationConfig createAuthenticationConfig(String serviceUrl) {
|
|
276 |
if (StringUtils.isBlank(serviceUrl)) {
|
|
268 | 277 |
return null; |
269 | 278 |
} |
270 |
DownloaderKeycloakCredentials theCredentials = (DownloaderKeycloakCredentials)credentials; |
|
271 |
DownloaderAuthenticationKeycloakConfig otherConfig = theCredentials.getConfig(); |
|
272 | 279 |
|
273 |
if (!DownloaderManager.areSameURLs(this.getKeycloakBaseurl(), otherConfig.getKeycloakBaseurl())) { |
|
274 |
return null; |
|
275 |
} |
|
276 |
if (!StringUtils.equals(this.getRealm(), otherConfig.getRealm())) { |
|
277 |
return null; |
|
278 |
} |
|
279 |
if (!StringUtils.equals(this.getClientid(), otherConfig.getClientid())) { |
|
280 |
return null; |
|
281 |
} |
|
282 |
if (!StringUtils.equals(this.getScope(), otherConfig.getScope())) { |
|
283 |
return null; |
|
284 |
} |
|
285 |
|
|
286 |
return new DownloaderKeycloakCredentials( |
|
287 |
this, |
|
288 |
theCredentials.getToken(), |
|
289 |
theCredentials.getUserid(), |
|
290 |
theCredentials.getTime() |
|
291 |
); |
|
280 |
DownloaderAuthenticationKeycloakConfig other = new DownloaderAuthenticationKeycloakConfig(null, serviceUrl); |
|
281 |
other.clientid = this.clientid; |
|
282 |
other.keycloakBaseurl = this.keycloakBaseurl; |
|
283 |
other.localPort = this.localPort; |
|
284 |
other.realm = this.realm; |
|
285 |
other.scope = this.scope; |
|
286 |
return other; |
|
292 | 287 |
} |
293 | 288 |
|
294 | 289 |
|
Also available in: Unified diff