Enforces login only for users with email addresses from approved domains.
// Source: https://github.com/iflytek/skillhub | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
package com.iflytek.skillhub.auth.policy;
import com.iflytek.skillhub.auth.oauth.OAuthClaims;
import java.util.Set;
/**
* Access policy that allows login only when the OAuth email belongs to an approved domain.
*/
public class EmailDomainAccessPolicy implements AccessPolicy {
private final Set<String> allowedDomains;
public EmailDomainAccessPolicy(Set<String> allowedDomains) {
this.allowedDomains = allowedDomains;
}
@Override
public AccessDecision evaluate(OAuthClaims claims) {
if (claims.email() == null || !claims.emailVerified()) return AccessD
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key