Optical code-division multiple-access (OCDMA) has been considered as a good candidate to provide optical layer security. In this paper, an enhanced OCDMA network security mechanism with pseudo-noise (PN) type of M-sequence coding switching is presented to against eavesdropping. Signature code unique to each OCDMA network user is reconfigured in accordance with the register state of a controlling electrical shift register. Examples of signature reconfiguration following state switching of controlling shift register for both network user and eavesdropper are numerically illustrated. It is shown that, by dynamically changing PN state of shift register to reconfigure user signature sequence, eavesdropper will encounter difficulty on decoding correct data sequences. The proposed scheme hence raises a high error probability for eavesdroppers. Accordingly, the degree of the proposed optical network confidentiality can be largely improved.