Question: ASP.NET Core 2.x includes some pre-made scaffolded routes, like the login page, settings, etc. I am working on something that only has OAuth login buttons, and no settings. This means that I don't want users to be able to register with an email, and I don't want any settings pages.

I can remove the link to things like the Settings page , however the routes still exist and can be accessed by typing them in. How do I **disable** these routes so they are completely inaccessible?

Basically everything under the `/Identity/Account/*` route, except for the login page should not be available.

Answer: 
**Approach #1**

We can use [`1D` convolution](https://www.numpy.org/devdocs/reference/generated/numpy.convolve.html) -

```
def nzeros(a, n):
    # Define kernel for 1D convolution
    k = np.ones(n,dtype=int)

    # Get sliding summations for zero matches with that kernel
    s = np.convolve(a==0,k)

    # Look for summations that are equal to n value, which will occur for
    # n consecutive 0s. Remember that we are using a "full" version of
    # convolution, so there's one-off offsetting because of the way kernel
    # slides across input data. Also, we need to create 1s at places where
    # n consective 0s end, so we would need to slice out ending elements.
    # Thus, we would end up with the following after int dtype conversion
    return (s==n).astype(int)[:-n+1]

```

Sample run -

```
In [46]: a
Out[46]: array([0, 0, 0, 0, 1, 0, 0, 0, 1, 1])

In [47]: nzeros(a,3)
Out[47]: array([0, 0, 1, 1, 0, 0, 0, 1, 0, 0])

In [48]: nzeros(a,2)
Out[48]: array([0, 1, 1, 1, 0, 0, 1, 1, 0, 0])

```

**Approach #2**

Another way to solve and this could be considered as a variant of the `1D` convolution approach, would be to use `erosion`, because if you look at the outputs, we can simply erode the mask of `0s` from the starts until `n-1` places. So, we can use [`scipy.ndimage.morphology's` `binary_erosion`](https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.ndimage.morphology.binary_erosion.html) that also allow us to specify the portion of kernel center with its `origin` arg, hence we will avoid any slicing. The implementation would look something like this -

```
from scipy.ndimage.morphology import binary_erosion

out = binary_erosion(a==0,np.ones(n),origin=(n-1)//2).astype(int)

```
Using for loop:

```
def nzeros(a, n):
  #Create a numpy array of zeros of length equal to n
  b = np.zeros(n)

  #Create a numpy array of zeros of same length as array a
  c = np.zeros(len(a), dtype=int)

  for i in range(0,len(a) - n):
    if (b == a[i : i+n]).all():  #Check if array b is equal to slice in a
      c[i+n-1] = 1

  return c

```

Sample Output:

```
print(nzeros(a, 3))
[0 0 1 1 0 0 0 1 0 0]

```