正在查看: bbinstant v6.24.0 应用的 Principal.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: bbinstant v6.24.0 应用的 Principal.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.amazonaws.auth.policy;
public class Principal {
private final String id;
private final String provider;
public static final Principal AllUsers = new Principal("AWS", "*");
public static final Principal AllServices = new Principal("Service", "*");
public static final Principal AllWebProviders = new Principal("Federated", "*");
public static final Principal All = new Principal("*", "*");
public enum Services {
AWSDataPipeline("datapipeline.amazonaws.com"),
AmazonElasticTranscoder("elastictranscoder.amazonaws.com"),
AmazonEC2("ec2.amazonaws.com"),
AWSOpsWorks("opsworks.amazonaws.com"),
AWSCloudHSM("cloudhsm.amazonaws.com"),
AllServices("*");
private String serviceId;
Services(String str) {
this.serviceId = str;
}
public static Services fromString(String str) {
if (str == null) {
return null;
}
for (Services services : values()) {
if (services.getServiceId().equalsIgnoreCase(str)) {
return services;
}
}
return null;
}
public String getServiceId() {
return this.serviceId;
}
}
public enum WebIdentityProviders {
Facebook("graph.facebook.com"),
Google("accounts.google.com"),
Amazon("www.amazon.com"),
AllProviders("*");
private String webIdentityProvider;
WebIdentityProviders(String str) {
this.webIdentityProvider = str;
}
public static WebIdentityProviders fromString(String str) {
if (str == null) {
return null;
}
for (WebIdentityProviders webIdentityProviders : values()) {
if (webIdentityProviders.getWebIdentityProvider().equalsIgnoreCase(str)) {
return webIdentityProviders;
}
}
return null;
}
public String getWebIdentityProvider() {
return this.webIdentityProvider;
}
}
public Principal(Services services) {
if (services == null) {
throw new IllegalArgumentException("Null AWS service name specified");
}
this.id = services.getServiceId();
this.provider = "Service";
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || !(obj instanceof Principal)) {
return false;
}
Principal principal = (Principal) obj;
return getProvider().equals(principal.getProvider()) && getId().equals(principal.getId());
}
public String getId() {
return this.id;
}
public String getProvider() {
return this.provider;
}
public int hashCode() {
return ((this.provider.hashCode() + 31) * 31) + this.id.hashCode();
}
public Principal(String str, String str2) {
this.provider = str;
this.id = "AWS".equals(str) ? str2.replaceAll("-", "") : str2;
}
public Principal(String str) {
if (str != null) {
this.id = str.replaceAll("-", "");
this.provider = "AWS";
return;
}
throw new IllegalArgumentException("Null AWS account ID specified");
}
public Principal(WebIdentityProviders webIdentityProviders) {
if (webIdentityProviders != null) {
this.id = webIdentityProviders.getWebIdentityProvider();
this.provider = "Federated";
return;
}
throw new IllegalArgumentException("Null web identity provider specified");
}
}