public static AuthorizationHandler getAuthZHandler() {
        return (AuthenticationData authN) -> {
            try {
                //framework checks for null authN so this shouldn't happen
                if (authN == null) {
                    throw new RuntimeException("Null AuthN data passed in!");
                }
                //check if the authN data type matches is a good idea, and necessary if there are other fields
                //to open/inspect
                if (authN instanceof ClientNameAuthenicationData) {
                    final ClientNameAuthenicationData data = (ClientNameAuthenicationData) authN;
                    //WARNING!!! this logic is for demonstration purposes
                    final String identityLabel = data.getIdentityLabel();
                    return identityLabel.startsWith("accepted.") ?
                            Authorization.ACCEPT : Authorization.REJECT;
                }
                //good idea to log reasons for rejection with the authentication label so testers/users can understand
                System.err.println("AuthN data type is not expected object type!");
                return Authorization.REJECT;
            } catch (Exception e) {
                return Authorization.REJECT;
            }
        };
    }
public static AuthorizationHandler getAuthZHandler() {
        return (AuthenticationData authN) -> {
            try {
               
                if (authN == null) {
                    throw new RuntimeException("Null AuthN data passed in!");
                }
               
               
                if (authN instanceof ClientNameAuthenicationData) {
                    final ClientNameAuthenicationData data = (ClientNameAuthenicationData) authN;
                   
                    final String identityLabel = data.getIdentityLabel();
                    return identityLabel.startsWith("accepted.") ?
                            Authorization.ACCEPT : Authorization.REJECT;
                }
               
                System.err.println("AuthN data type is not expected object type!");
                return Authorization.REJECT;
            } catch (Exception e) {
                return Authorization.REJECT;
            }
        };
    }
public static authorizationhandler getauthzhandler() { return (authenticationdata authn) -> { try { if (authn == null) { throw new runtimeexception("null authn data passed in!"); } if (authn instanceof clientnameauthenicationdata) { final clientnameauthenicationdata data = (clientnameauthenicationdata) authn; final string identitylabel = data.getidentitylabel(); return identitylabel.startswith("accepted.") ? authorization.accept : authorization.reject; } system.err.println("authn data type is not expected object type!"); return authorization.reject; } catch (exception e) { return authorization.reject; } }; }