use of com.openshift.restclient.authorization.IAuthorizationDetails in project jbosstools-openshift by jbosstools.
the class OAuthDetailView method createAuthDetailsJob.
protected Job createAuthDetailsJob(Shell shell) {
Job job = new AuthDetailsJob(pageModel.getHost());
job.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(final IJobChangeEvent event) {
if (event.getJob() instanceof AuthDetailsJob) {
shell.getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
AuthDetailsJob job = (AuthDetailsJob) event.getJob();
final IAuthorizationDetails details = job.getDetails();
if (details != null) {
// TODO fix this to handle other authschemes
if (IAuthorizationContext.AUTHSCHEME_BASIC.equals(details.getScheme())) {
MessageDialog.openError(shell, "Authorization Information", NLS.bind("This server utilizes {0} authorization protocol", details.getScheme()));
authSchemeObservable.setValue(details.getScheme());
} else {
OAuthDialog dialog = new OAuthDialog(shell, details.getRequestTokenLink());
dialog.open();
String token = dialog.getToken();
if (StringUtils.isNotBlank(token)) {
tokenObservable.setValue(token);
}
}
}
}
});
}
}
});
return job;
}
Aggregations