public static < T extends Credential > T getCredential ( final RequestContext context , final @ NonNull Class < T > clazz ) { val credential = getCredential ( context ) ; if ( credential == null ) { return null ; } if ( ! clazz . isAssignableFrom ( credential . getClass ( ) ) ) { throw new ClassCastException ( "credential [" + credential . getId ( ) + " is of type " + credential . getClass ( ) + " when we were expecting " + clazz ) ; } return ( T ) credential ; }
Gets credential .