/** * Returns a new identity representing anyone who is authenticated with a Google account or a * service account. */ public static Identity allAuthenticatedUsers() { return new Identity(Type.ALL_AUTHENTICATED_USERS, null); }
/** * Returns a new identity representing anyone who is on the internet; with or without a Google * account. */ public static Identity allUsers() { return new Identity(Type.ALL_USERS, null); }
/** * Returns a new user identity. * * @param email An email address that represents a specific Google account. For example, * <I>alice@gmail.com</I> or <I>joe@example.com</I>. */ public static Identity user(String email) { return new Identity(Type.USER, checkNotNull(email)); }
/** * Returns a new project editor identity. * * @param projectId A Google Cloud Platform project ID. For example, <I>my-sample-project</I>. */ public static Identity projectEditor(String projectId) { return new Identity(Type.PROJECT_EDITOR, checkNotNull(projectId)); }
/** * Returns a new domain identity. * * @param domain A Google Apps domain name that represents all the users of that domain. For * example, <I>google.com</I> or <I>example.com</I>. */ public static Identity domain(String domain) { return new Identity(Type.DOMAIN, checkNotNull(domain)); }
/** * Returns a new project owner identity. * * @param projectId A Google Cloud Platform project ID. For example, <I>my-sample-project</I>. */ public static Identity projectOwner(String projectId) { return new Identity(Type.PROJECT_OWNER, checkNotNull(projectId)); }
/** * Returns a new service account identity. * * @param email An email address that represents a service account. For example, * <I>my-other-app@appspot.gserviceaccount.com</I>. */ public static Identity serviceAccount(String email) { return new Identity(Type.SERVICE_ACCOUNT, checkNotNull(email)); }
/** * Returns a new group identity. * * @param email An email address that represents a Google group. For example, * <I>admins@example.com</I>. */ public static Identity group(String email) { return new Identity(Type.GROUP, checkNotNull(email)); }
/** * Returns a new project viewer identity. * * @param projectId A Google Cloud Platform project ID. For example, <I>my-sample-project</I>. */ public static Identity projectViewer(String projectId) { return new Identity(Type.PROJECT_VIEWER, checkNotNull(projectId)); }
/** * Converts a string to an {@code Identity}. Used primarily for converting protobuf-generated * policy identities to {@code Identity} objects. */ public static Identity valueOf(String identityStr) { String[] info = identityStr.split(":"); Type type = Type.valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, info[0])); if (info.length == 1) { return new Identity(type, null); } else if (info.length == 2) { return new Identity(type, info[1]); } else { throw new IllegalArgumentException("Illegal identity string: \"" + identityStr + "\""); } } }
/** * Returns a new identity representing anyone who is authenticated with a Google account or a * service account. */ public static Identity allAuthenticatedUsers() { return new Identity(Type.ALL_AUTHENTICATED_USERS, null); }
/** * Returns a new identity representing anyone who is on the internet; with or without a Google * account. */ public static Identity allUsers() { return new Identity(Type.ALL_USERS, null); }
/** * Returns a new identity representing anyone who is authenticated with a Google account or a * service account. */ public static Identity allAuthenticatedUsers() { return new Identity(Type.ALL_AUTHENTICATED_USERS, null); }
/** * Returns a new group identity. * * @param email An email address that represents a Google group. For example, * <I>admins@example.com</I>. */ public static Identity group(String email) { return new Identity(Type.GROUP, checkNotNull(email)); }
/** * Returns a new project editor identity. * * @param projectId A Google Cloud Platform project ID. For example, <I>my-sample-project</I>. */ public static Identity projectEditor(String projectId) { return new Identity(Type.PROJECT_EDITOR, checkNotNull(projectId)); }
/** * Returns a new user identity. * * @param email An email address that represents a specific Google account. For example, * <I>alice@gmail.com</I> or <I>joe@example.com</I>. */ public static Identity user(String email) { return new Identity(Type.USER, checkNotNull(email)); }
/** * Returns a new domain identity. * * @param domain A Google Apps domain name that represents all the users of that domain. For * example, <I>google.com</I> or <I>example.com</I>. */ public static Identity domain(String domain) { return new Identity(Type.DOMAIN, checkNotNull(domain)); }
/** * Returns a new domain identity. * * @param domain A Google Apps domain name that represents all the users of that domain. For * example, <I>google.com</I> or <I>example.com</I>. */ public static Identity domain(String domain) { return new Identity(Type.DOMAIN, checkNotNull(domain)); }
/** * Returns a new service account identity. * * @param email An email address that represents a service account. For example, * <I>my-other-app@appspot.gserviceaccount.com</I>. */ public static Identity serviceAccount(String email) { return new Identity(Type.SERVICE_ACCOUNT, checkNotNull(email)); }
/** * Returns a new group identity. * * @param email An email address that represents a Google group. For example, * <I>admins@example.com</I>. */ public static Identity group(String email) { return new Identity(Type.GROUP, checkNotNull(email)); }