本文整理了Java中ch.cyberduck.core.Protocol.getAuthorization()
方法的一些代码示例,展示了Protocol.getAuthorization()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Protocol.getAuthorization()
方法的具体详情如下:
包路径:ch.cyberduck.core.Protocol
类名称:Protocol
方法名:getAuthorization
暂无
代码示例来源:origin: iterate-ch/cyberduck
@Override
public String getAuthorization() {
final String v = this.value("Authorization");
if(StringUtils.isBlank(v)) {
return parent.getAuthorization();
}
return v;
}
代码示例来源:origin: iterate-ch/cyberduck
public static AuthenticationHeaderSignatureVersion getDefault(final Protocol protocol) {
try {
return S3Protocol.AuthenticationHeaderSignatureVersion.valueOf(protocol.getAuthorization());
}
catch(IllegalArgumentException e) {
log.warn(String.format("Unsupported authentication context %s", protocol.getAuthorization()));
return S3Protocol.AuthenticationHeaderSignatureVersion.valueOf(
PreferencesFactory.get().getProperty("s3.signature.version"));
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public void setUserName(final String input) {
final String user;
final AuthScheme scheme;
if(StringUtils.contains(input, ':')) {
// Support non default auth scheme (PAM)
user = StringUtils.splitPreserveAllTokens(input, ':')[1];
// Defaults to standard if not found
scheme = AuthScheme.findTypeByString(StringUtils.splitPreserveAllTokens(input, ':')[0]);
}
else {
user = input;
if(StringUtils.isNotBlank(host.getProtocol().getAuthorization())) {
scheme = AuthScheme.findTypeByString(host.getProtocol().getAuthorization());
}
else {
// We can default to Standard if not specified
scheme = AuthScheme.STANDARD;
}
}
super.setUserName(user);
this.setAuthenticationScheme(scheme);
}
}
代码示例来源:origin: iterate-ch/cyberduck
.authType(LoginRequest.AuthTypeEnum.fromValue(session.getHost().getProtocol().getAuthorization()))
.login(user)
.password(password)).getToken();
代码示例来源:origin: iterate-ch/cyberduck
@Override
public boolean equals(Object o) {
if(this == o) {
return true;
}
if(!(o instanceof Protocol)) {
return false;
}
Protocol protocol = (Protocol) o;
if(this.getIdentifier() != null ? !this.getIdentifier().equals(protocol.getIdentifier()) : protocol.getIdentifier() != null) {
return false;
}
if(this.getScheme() != null ? !this.getScheme().equals(protocol.getScheme()) : protocol.getScheme() != null) {
return false;
}
if(this.getContext() != null ? !this.getContext().equals(protocol.getContext()) : protocol.getContext() != null) {
return false;
}
if(this.getAuthorization() != null ? !this.getAuthorization().equals(protocol.getAuthorization()) : protocol.getAuthorization() != null) {
return false;
}
if(this.getProvider() != null ? !this.getProvider().equals(protocol.getProvider()) : protocol.getProvider() != null) {
return false;
}
if(this.getDefaultHostname() != null ? !this.getDefaultHostname().equals(protocol.getDefaultHostname()) : protocol.getDefaultHostname() != null) {
return false;
}
return true;
}
代码示例来源:origin: iterate-ch/cyberduck
final String password = host.getCredentials().getPassword();
switch(SDSProtocol.Authorization.valueOf(host.getProtocol().getAuthorization())) {
case oauth:
authorizationService.setTokens(authorizationService.authorize(host, controller, cancel));
.authType(LoginRequest.AuthTypeEnum.fromValue(host.getProtocol().getAuthorization()))
.login(login)
.password(additional.getPassword())
.authType(LoginRequest.AuthTypeEnum.fromValue(host.getProtocol().getAuthorization()))
.login(login)
.password(password)
代码示例来源:origin: iterate-ch/cyberduck
private String login(final LoginCallback controller, final LoginRequest request) throws BackgroundException {
try {
try {
return new AuthApi(client).login(request).getToken();
}
catch(ApiException e) {
throw new SDSExceptionMappingService().map(e);
}
}
catch(PartialLoginFailureException e) {
final Credentials additional = controller.prompt(host, host.getCredentials().getUsername(),
LocaleFactory.localizedString("Provide additional login credentials", "Credentials"), e.getDetail(),
new LoginOptions()
.icon(host.getProtocol().disk())
.user(false)
.keychain(false)
);
return this.login(controller, new LoginRequest()
.authType(LoginRequest.AuthTypeEnum.fromValue(host.getProtocol().getAuthorization()))
.password(additional.getPassword())
);
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
protected SDSApiClient connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt) {
final HttpClientBuilder configuration = builder.build(proxy, this, prompt);
switch(SDSProtocol.Authorization.valueOf(host.getProtocol().getAuthorization())) {
case oauth:
authorizationService = new OAuth2RequestInterceptor(builder.build(proxy, this, prompt).addInterceptorLast(new HttpRequestInterceptor() {
内容来源于网络,如有侵权,请联系作者删除!