UDS is not a AUTOSAR only concept, it was defined long ago as ISO-14229.
There can be more than one Security Level. Usually, they are also a bit bound to the Diagnostic Sessions.
Each Session can have a separate Security Level, with different Seed/Key and/or SecurityAlgorithms:
* ProgrammingSession -> SecurityLevel 1
* ExtendedSession -> SecurityLevel 3
* SupplierSpecific/User Session -> SecurityLevel 5 ...
As already stated, the Client has to request the seed and calculates a key, which the ECU does the same. The client then sends the Key which the ECU will compare against its own calculated expected key.
If it does not match, there will be a negative response, and the security level will not be reached.
If the Session times out or if the session is changed, the Security Level is set back to Locked state.
Services can be configured regarding availability and execution by assignment to certain Sessions and SecurityLevels.